Maybe you should send the var through each page, you need to store it and get it by method. store it: :locals => {:var = @a}
get it: var = local_assigns[:var] On May 10, 2:21 am, 7stud -- <rails-mailing-l...@andreas-s.net> wrote: > 7stud -- wrote: > > Frederick Cheung wrote: > >> On May 9, 6:47 am, 7stud -- <rails-mailing-l...@andreas-s.net> wrote: > > >>> @cart = [1, 2, 3] > >>> end > >>> end > > >> if you go to /store that's just the index action > > > Yes. I realize that> > > >> so add_to_cart is > >> never called and @cart is not set. > > > Ok, but if I go to /store/index why does the add_to_cart view ever come > > into play? @ variables in other actions are not set when /store/index > > executes, so why doesn't rails throw errors when their views reference > > the @ variables set in their actions? > > Ai yi yi. I'm putting the partial in the store *layout* so all the > store views use it--including the index view. > > Thanks. > -- > Posted viahttp://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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---