I''m opening a view and passing multiple key/value pairs within one symbol like so: <%= link_to ''view'', {:controller => ''screens'', :action => "content", :data => {"title" => "Body", "content" => screen.body}} %> What''s the proper way to access these from the view I''m rendering? I can access the params object to get at the info if I''m only passing one value, but I''m having problems getting at both key/value pairs. I''ve tried multiple variations of the following with no success: <%= params[:data["title"]] %> Thanks, -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 11 Jan 2008, at 16:04, Corey Murphy wrote:> > I''m opening a view and passing multiple key/value pairs within one > symbol like so: > > <%= link_to ''view'', {:controller => ''screens'', > :action => "content", > :data => {"title" => "Body", "content" => > screen.body}} %> > > What''s the proper way to access these from the view I''m rendering? I > can access the params object to get at the info if I''m only passing > one > value, but I''m having problems getting at both key/value pairs. > > I''ve tried multiple variations of the following with no success: > > <%= params[:data["title"]] %> >params[:data][:title] (the params hash is magic so it doesn''t matter if you use strings or keys) Fred> Thanks, > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> params[:data][:title] > (the params hash is magic so it doesn''t matter if you use strings or > keys) > > FredWorks perfectly. Thanks Fred. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---