Hello. I want to be able to set what''s in an association without
Rails trying to update the database.
Assume a Page has many Links.
I want to be able to say this...
page = Page.find :first
links = Links.find :all, :conditions => ["page_id != ?", page.id]
page.links = links
Without Rails trying to update the database and trying to set page_id
on all the records in links.
I wish it was as simple as saying...
page.instance_variable_set(''@links'', links)
but it''s not because links is an association proxy object.
Any ideas? Thanks.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On May 22, 11:39 pm, "Christopher J. Bottaro" <cjbott...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I want to be able to say this... > > page = Page.find :first > links = Links.find :all, :conditions => ["page_id != ?", page.id] > page.links = links > > Without Rails trying to update the database and trying to set page_id > on all the records in links.page.links.target = links Use the source, Luke. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---