Attribute_fu jquery edge rails 2.2 merge

2 views
Skip to first unread message

illusina

unread,
Nov 15, 2008, 6:16:26 PM11/15/08
to attribute_fu
Hey Maintainers, do you think you could merge the latest fixes you
made regarding edge rails into the jquery branch? I would be very
thankful, and I think many others would be as well. I was going to try
and merge it myself using git, but I fear I might mess it up :|. If
there is any way I can help let me know!

Thanks,

- Tyler

illusina

unread,
Nov 19, 2008, 12:46:55 AM11/19/08
to attribute_fu
Alright, following up on this, I just merged in the form_helper from
the jquery branch into the newest main branch and the UI is working
fine. However, I'm having additional errors now on both updating an
existing record with associations, and creating a new record that has
associations. Case/code examples:

[code]
class DeviceType < ActiveRecord::Base
....snip
has_many :device_type_data_registers
has_many :data_registers, :through
=> :device_type_data_registers, :attributes => true
....snip
end

class DataRegister < ActiveRecord::Base
...snip
has_one :device_type, :through => :device_type_data_registers
...snip
end
[/code]

Now, whenever I submit a new form creating a new Device Type with
associated Data Registers (form data example: ), and anything in the
Data Register is invalid, I get two "Data registers is invalid"
messages, and a blank form for a new data register is appended (as
though I had hit add_associated_link) in addition to my previously
submitted Data Register. This pattern repeats as submitting again with
2 blank data registers gives me 3 invalid messages, and 3 blank forms,
and so on.

When trying to update an existing Device Type, I can correctly update
preexisting data register fields, and add new ones via
add_associated_link, but the save does not add them to the Device
Type, but instead, as was noted by http://groups.google.com/group/attribute_fu/t/a744821c970f4d3a
they are saved to the database unassociated with any Device Type.

I hope these symptoms help in diagnosing the problem!

- Tyler

illusina

unread,
Nov 19, 2008, 1:48:54 PM11/19/08
to attribute_fu
Also, I have a copy of my app on git if you wanted to try and
replicate the problem:

http://github.com/idylenet/mhscp/tree/master
> Type, but instead, as was noted byhttp://groups.google.com/group/attribute_fu/t/a744821c970f4d3a

illusina

unread,
Nov 24, 2008, 5:54:43 PM11/24/08
to attribute_fu
Well, even though the moderators aren't on this forum anymore
apparently, I'm gonna continue to log this issue for future
reference.

I have isolated the "submit 1 get 2 back" bug to the
add_associated_link "My Link", @device_type.data_registers.build
command, which seems to build a new data_register upon it's evaluation
within the view. So I can remove that line from the view and my form
stays stable when I submit an error, but now I don't have a means to
add a new data register form.

This seems to make sense that this line would create a new instance in
my data_registers, and that it would be necessary to a_f developers to
have an instance of the child object with the proper references, but
it's causing problems! The strangest part is that this was all working
on rails 2.0.1, which I even tried reverting to and checking out an
old version of a_f from github, but even more stuff breaks when I try
that.

I'm running out of options, so I figure I'll have to hand code these
associations or find another plugin. Any suggestions greatly
appreciated.
Reply all
Reply to author
Forward
0 new messages