Short version of the problem: Why this works session[:sub_menu].fetch(:stock) and this don''t? session[:sub_menu].fetch("stock") thanks David Sousa -- 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 -~----------~----~----~----~------~----~------~--~---
Because :foo != ''foo'' The fact that the params hash doesn''t care is an exception Sent from my iPhone On 27 Dec 2008, at 23:01, David Sousa <rails-mailing-list@andreas- s.net> wrote:> > Short version of the problem: > > Why this works > session[:sub_menu].fetch(:stock) > and this don''t? > session[:sub_menu].fetch("stock") > > > thanks > > David Sousa > -- > 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 -~----------~----~----~----~------~----~------~--~---
Thanks Frederick. I want to do something like: <% session[:sub_menu].fetch(controller.controller_name) do |sub_menu| -%> <% sub_menu.each do |menu| -%> <li> <%= link_to "#{menu[:presentation_name]}", :controller => "#{menu[:controller]}", :action => "#{menu[:action]}" %> </li> <% end -%> <% end -%> Where the main idea is to fetch the hash values for the key that has the same name of the controller. What do you suggest? tks again. David Sousa -- 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 27 Dec 2008, at 23:15, David Sousa wrote:> > Thanks Frederick. > > I want to do something like: > > <% session[:sub_menu].fetch(controller.controller_name) do |sub_menu| > -%> > <% sub_menu.each do |menu| -%> > <li> > <%= link_to "#{menu[:presentation_name]}", :controller => > "#{menu[:controller]}", :action => "#{menu[:action]}" %> > </li> > <% end -%> > <% end -%> > > Where the main idea is to fetch the hash values for the key that has > the > same name of the controller.> What do you suggest? >It doesn''t matter whether you use symbols or strings for your session keys as long as you pick one and stick with it. Fred> tks again. > > David Sousa > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Hey Frederick thank you very much.... How was x-mas? (I hope you are not Jewish or some thing like that!) Have a happy new year... tks again. David Sousa -- 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 -~----------~----~----~----~------~----~------~--~---