I''m trying to pass an object as a parameter on a link_to_remote. What I do is pretty simple: link_to_remote ''Insert subquestion'', :url => {:action => ''add_subquestion'', :question => @question}, :update => '''', :method => :get But, obviously, what I get is a string which has the address of the object. Can I "translate" this string back to the object? Is there a better way to pass an object as a param? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 13, 7:04 pm, Yuri <yuridenom...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to pass an object as a parameter on a link_to_remote. What > I do is pretty simple: > link_to_remote ''Insert subquestion'', :url => {:action => > ''add_subquestion'', :question => @question}, :update => '''', :method > => :get > > But, obviously, what I get is a string which has the address of the > object. Can I "translate" this string back to the object?No. There is no way I know of to translate an address back into an actual object (although writing a ruby extension to do that is probably possible). Anyway, the request may have gone to a different mongrel or the original object may have been garbage collected> Is there a > better way to pass an object as a param?pass its id Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
But it''s a new object. It doesn''t have any id yet. But I think I have a solution. Instead of passing an id, adress or object_id, I''ll pass it''s subquestion''s array length. Then all I have to do is put one more subquestion. Thank you, anyway. On 13 jan, 15:27, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 13, 7:04 pm, Yuri <yuridenom...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m trying to pass an object as a parameter on a link_to_remote. What > > I do is pretty simple: > > link_to_remote ''Insert subquestion'', :url => {:action => > > ''add_subquestion'', :question => @question}, :update => '''', :method > > => :get > > > But, obviously, what I get is a string which has the address of the > > object. Can I "translate" this string back to the object? > > No. There is no way I know of to translate an address back into an > actual object (although writing a ruby extension to do that is > probably possible). Anyway, the request may have gone to a different > mongrel or the original object may have been garbage collected > > > Is there a > > better way to pass an object as a param? > > pass its id > > Fred-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.