Hobo association magic and rails autosave don't play well together
Reported by Betelgeuse | November 6th, 2009 @ 12:40 AM | in Hobo 1.0 - Final
(rdb:1) p c.save
ArgumentError Exception: wrong number of arguments (3 for 1)
upstream rails:
betelgeuse@pena /mnt/checkouts/rails $ grep "def insert_record" -r .
./activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb: def insert_record(record, force = true, validate = true)
./activerecord/lib/active_record/associations/has_many_through_association.rb: def insert_record(record, force = true, validate = true)
./activerecord/lib/active_record/associations/has_many_association.rb: def insert_record(record, force = false, validate = true)
hobo:
betelgeuse@pena ~/hobo/hobo-git $ grep "def insert_record" -r .
./hobo/lib/hobo/permissions/associations.rb: def insert_record(record)
./hobo/lib/hobo/permissions/associations.rb: def insert_record(record, force=true)
You get here from:
(rdb:1) l =
[284, 293] in /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/autosave_association.rb
284 records.each do |record|
285 if autosave && record.marked_for_destruction?
286 association.destroy(record)
287 elsif @new_record_before_save || record.new_record?
288 if autosave
=> 289 association.send(:insert_record, record, false, false)
290 else
291 association.send(:insert_record, record)
292 end
293 elsif autosave
I hit this with accepts_nested_attributes_for. I think hobo needs to gain support for the validate parameter.
Comments and changes to this ticket
-
Betelgeuse November 6th, 2009 @ 12:41 AM
- Title changed from Hobo validation patching and rails autosave don't play well together to Hobo assocation magic and rails autosave don't play well together
-
Betelgeuse November 6th, 2009 @ 12:41 AM
- Title changed from Hobo assocation magic and rails autosave don't play well together to Hobo association magic and rails autosave don't play well together
-
Bryan Larsen November 16th, 2009 @ 07:32 PM
- State changed from new to open
- Tag changed from 2.3, models to 2.3, defect, model
- Milestone set to Hobo 1.0 - Final
Thanks for the heads up. I was hoping that this was a Rails3 bug but by your tag, I'm guessing it's going to bite us for 2.3.5.
-
Bryan Larsen November 17th, 2009 @ 08:23 PM
- State changed from open to resolved
(from [4f527683f40a6cb07e37202637251f2e384225e4]) [#529 state:resolved]
using the
:autosave => true
option on associations fails with Rails
2.3. Fix.
http://github.com/tablatom/hobo/commit/4f527683f40a6cb07e3720263725... -
Bryan Larsen November 19th, 2009 @ 04:56 PM
(from [b48249914558f2bc931a19900df2b5d5da749e75]) [#529] fix undefined method
insert_record_without_user_save' bug I introduced with the fix for [#529](/projects/8324/tickets/529 "Ticket #529").<br/> http://github.com/tablatom/hobo/commit/b48249914558f2bc931a19900df2b5d5da749e75
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Referenced by
- 529 Hobo association magic and rails autosave don't play well together (from [b48249914558f2bc931a19900df2b5d5da749e75]) [#529] ...
- 529 Hobo association magic and rails autosave don't play well together (from [4f527683f40a6cb07e37202637251f2e384225e4]) [#529 s...