For sources in Rriki the user types in a list of authors for that publication and RRiki takes care of looking up the database of known authors, creating new entries if need be and then linking the relevant authors to the publication. This is all good and dandy for the user, but editing poses a problem:
From api.rubyonrails.org we have :
All that was needed was to not use the bundled
Another instance where it is necessary to break into the comfy 'it just works' world of rails and customize some of the magic.
update_attributes
takes its information from the form, which does not have the association information.From api.rubyonrails.org we have :
def update_attributes(attributes)
self.attributes = attributes
save
end
All that was needed was to not use the bundled
update_attributes
and instead manually do@source.attributes = params[:source]
@source.attach_authors_to_this_source
@source.save
Another instance where it is necessary to break into the comfy 'it just works' world of rails and customize some of the magic.
I happen to face a similar problem, but I use auto complete fields on the forms and then link them in the update method.
ReplyDelete@ Tarun: i have tried the similar approach what you have taken but in my case its not working ???
ReplyDelete