This project is archived and is in readonly mode.
Rails3: find_by_property1_and_property2 for has_many associations was broken after upgrade to RC
Reported by petRUShka | August 1st, 2010 @ 09:12 PM
class City < ActiveRecord::Base
has_many :locations, :dependent => :destroy
end
Common has_many association. Before upgrade to RC it was ok. But after upgrade:
irb(main):027:0> c = City.first
=> #<City id: 1, name: "belgorod", created_at: "2010-07-11 11:13:31", updated_at: "2010-07-11 11:13:31">
irb(main):030:0> c.locations.find_by_name_and_created_at "a", Time.now
=> nil
irb(main):031:0> c.locations.find_or_create_by_name_and_created_at "a", Time.now
NoMethodError: undefined method `find_by_nameandcreated_at' for []:Array
from /usr/lib/ruby/gems/svn/gems/activerecord-3.0.0.rc/lib/active_record/associations/association_proxy.rb:154:in `send'
from /usr/lib/ruby/gems/svn/gems/activerecord-3.0.0.rc/lib/active_record/associations/association_collection.rb:425:in `method_missing'
from (irb):31
from /usr/lib/ruby/gems/svn/gems/railties-3.0.0.rc/lib/rails/commands/console.rb:44:in `start'
from /usr/lib/ruby/gems/svn/gems/railties-3.0.0.rc/lib/rails/commands/console.rb:8:in `start'
from /usr/lib/ruby/gems/svn/gems/railties-3.0.0.rc/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:9:in `require'
from script/rails:9:in `<main>'
ruby 1.9.3dev (2010-05-08 trunk 27674) [x86_64-linux]
Rails3.RC
Comments and changes to this ticket
-
Santiago Pastorino August 2nd, 2010 @ 12:33 AM
- State changed from new to resolved
- Importance changed from to Low
petRUShka this was fixed here http://github.com/rails/rails/commit/9d109302f139a23d18de6054540747...
Try with the master code and let me know ;).
Thanks for reporting the issue, though.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>