Displaying 20 results from an estimated 200 matches similar to: "Find all association methods"
2012 Jan 17
3
Saving without callbacks in Rails 3
Hi all,
Saving without callbacks is not working in rails 3.1.
please tell me alternatives available......
Thanks,
Kingston
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
2012 Jan 21
4
why doesn't an instance of Object get Class's new instance method?
"Object is the root of Ruby''s class hierarchy. Its methods are
available to all classes unless explicitly overridden."
Wouldn''t Class class be at the root of the class hierarchy?
After all, look at this:
1.9.2p290 :006 > Object.instance_of? Class
=> true
Object is an instance of class, after all we can use one of Class''
instance methods on Object:
2012 Jan 05
2
Error while rake actions
rake aborted!
/home/Mahesh/uma/myapp/Rakefile:6: unterminated string meets end of file
/usr/local/lib/ruby/1.9.1/rake.rb:2373:in `load''
/usr/local/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile''
/usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile''
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling''
2011 Oct 11
10
Create Two objects at the same time
I have user model and referral model. Referral model has user_id as
field.
Now when a new user is created, I need to call referral#create as well
and pass it the id of the newly generated user to user_id of referral
model. How can I do that.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2012 Jan 15
2
DEPRECATION WARNING: Passing a template handler in the template name is deprecated. (rspec + haml)
I upgraded a small project that I had created on 3.1.3 to 3.2.0.rc2.
Running rspec on it brings about a large amount of these messages:
DEPRECATION WARNING: Passing a template handler in the template name is
deprecated. You can simply remove the handler name or pass render :handlers
=> [:haml] instead. (called from block (2 levels) in <top (required)> at
2012 Jan 11
1
Can't create new rails project behind proxy
When I run:
rails new <app_name>
I get the following error:
Fetching source index for http://rubygems.org/
Could not reach rubygems repository http://rubygems.org/
Could not find gem ''turn (>= 0) x86-mingw32'' in any of the gem sources
listed in your Gemfile.
I think the problem is that I''m behind a proxy. How can I get the
rails command to use a proxy?
--
2012 Feb 18
6
rake db:reset doesn't work, fails with unknown attribute: user_status
If I manually drop the database, and run create, then migrate it works fine.
But doing a:
rake db:reset
it fails with:
unknown attribute: user_status
Does this mean my migrations are not dropping things correctly?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2012 Feb 01
12
date validation in rails 3
consider scenario,
User model with name, birth_date fields (here birth_date is not mandatory
field)
inside view form birth_date is assigned as ''31/31/1985'' which is invalid
ideally user object should be invalid and while save raise an error on
birth_date field but that''s not happening and user object gets saved with
birth_date as blank which is completely misleading.
2012 Feb 05
4
Rspec and restful routes
Hi all,
I''m trying to test that my users show page renders. The resource has
the route /users/:id
How would I code that for an Rspec test? So far I''ve tried these four
ways:
it "should have a users show path" do
get user_path(:action => ''show'')
end
it "should have a users show path" do
get user_show_path
end
it "should have
2012 Jan 21
16
Installing rails on Ubuntu
Hello, I''m trying to install the rails on ubuntu 11.10, but when I put
the command
felipe@Felipe:~/Downloads/rubygems-1.8.15$ sudo gem install rails
--no-r1 --no-rdoc
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
felipe@Felipe:~/Downloads/rubygems-1.8.15$
2012 Jan 25
4
serializable_hash and serializable_add_includes
I''m trying to write a helper method similar to attr_accessible but
instead it will be used to whitelist which attributes are available for
serialization (attr_serializable). My first attempt at this was to
override serialized_hash and modify the :only option to include nothing
but serializable attributes. I''m facing a problem when nested models
are ''included''
2011 Oct 04
9
Postgresql adapter not working
Hello everyone. I''m starting with Rails going through the obvious
"Getting Started with Rails" guide:
http://guides.rubyonrails.org/getting_started.html
Everything goes smoothly until the rake db:create command, which
returns this strange error message referring to a gem that apparently
doesn''t exist:
Please install the postgresql adapter: `gem install activerecord-
2012 Mar 04
3
Which command run after change Models
Hi:
I''m reading and learning from the Rails tutorial at [1] but not building
the sample application instead I''m trying to build my own. After
generate all the migration and build the main classes for Models I made
some modifications to them in order to build relationship between tables
now I think that I need to run some command to generate the scaffold
again with proper
2007 Feb 16
6
some fun functionality for all your specs
I''ve found these two snippets of code useful and would love some feedback.
first, .should_have_valid_associations
usage:
context "A new Product" do
specify "should have valid associations" do
@product.should_have_valid_associations
end
end
code: (thanks to Wilson/Defiler for converting to rspec)
module Spec
module Expectations
module Should
2006 Jun 08
3
Relationship and reflection
Hello,
I have a question.
I would like to know if there is a way with the reflection and
respond_to? to know if there is a relationship between tables.
When I say that I mean if inside a model there is a Has_many or
belongs_to declaration. Because I try to get this information
dynamically, during the execution of a script.
If someone has an idea even if it''s not with the reflection,
2012 Feb 06
3
Bundler - how to re-install all gems after os update?
I had a working Rails setup using RVM on Ubuntu 11.10 with /home on a
separate partition. I installed Ubuntu 12.04 (Alpha) on the root
partition, leaving the home partition unchanged. I now find that some
things don''t work, I think due to the fact that the system has been
updated and versions of libraries have changed. For example I get:
$ rails c
2012 Feb 12
3
Rails routes - destroy
Can''t figure out how duplicate routes are differentiated by rails ...
Read routing from inside out and API as well as a few tutorials but
still don''t get it!!! For example...
routes.rb
resources :minisections do
resources :questions
end
rake routes:
minisection_question GET
/minisections/:minisection_id/questions/:id(.:format)
questions#show
2011 Oct 02
4
Aggregated attribute changed but _was is changed too. So nothing is update in database.
(Frenchy, sorry =) )
Hi everyone, i''ve got some troubles with aggregated attribute.
I created a point and path class which receive postgresql point and
path type data. Path object contains an array of point object.
I''m currently working on a "hunting" module in web browser based game,
and i need a crontab executed every n minutes to move the character on
the map.
2006 Apr 19
2
Using Reflections to find out ActiveRecord class association
I want to find out what are the associations with another active record
class. So If my class is as below:
Class Component < ActiveRecord::Base
has_many :branches
end
class Branch < ActiveRecord::Base
belongs_to :component
end
and then I do
Component.reflections[:branches].active_record
I would expect that to be Branch but it is in fact Component.
The inspection of
2007 Aug 14
2
Finding a models asscoations
Hi,
I cant seem to find the answer to this anywhere so any help/advice is
appreciated.
Each project has one risk and a risk has a number of has/one belongs to
assocations. So what i want to do is in my code loop through all the
associations for a risk and display some field information from each as
they are pretty similar. So somehting like
<% for model_association in project.risks %>