Hi! I have made an scaffold for Item table like script/generate scaffold Item. Everything went fine, but now i like to add list action to controller Def list $items = Item.finde(:all) end I have added it, but how i can see the template like http://address/items/list Can i redirect it some how? Action index does same thing as list action,but i want to make different kind of view for those. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
torso wrote:> Hi! > > I have made an scaffold for Item table like script/generate scaffold > Item. Everything went fine, but now i like to add list action to > controller > > Def list > $items = Item.finde(:all) > end > I have added it, but how i can see the template like > http://address/items/list > > Can i redirect it some how? > Action index does same thing as list action,but i want to make > different kind of view for those.I think you did not declare it in your rooting file. Try to add/update something like that : map.resources :items, :collection => { :list => :get } Hope this helps. Guillaume Petit http://www.nomadsper.com -- 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 -~----------~----~----~----~------~----~------~--~---
So i have to add it to the routers.rb in config directory. Am i right? On Jun 30, 12:42 pm, Guillaume Petit <rails-mailing-l...@andreas- s.net> wrote:> torso wrote: > > Hi! > > > I have made an scaffold for Item table like script/generate scaffold > > Item. Everything went fine, but now i like to add list action to > > controller > > > Def list > > $items = Item.finde(:all) > > end > > I have added it, but how i can see the template like > >http://address/items/list > > > Can i redirect it some how? > > Action index does same thing as list action,but i want to make > > different kind of view for those. > > I think you did not declare it in your rooting file. > > Try to add/update something like that : > > map.resources :items, > :collection => { > :list => :get > } > > Hope this helps. > > Guillaume Petithttp://www.nomadsper.com > -- > 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-/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 -~----------~----~----~----~------~----~------~--~---
in config/routes.rb yes -- 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 -~----------~----~----~----~------~----~------~--~---
I would be more concerned with the fact he''s defining $items in his action... The $ signifies a global variable, which I personally have never found a use for. Change the $ to a @ to make it an instance variable so the variable is only defined for that instance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---