How do I regain freedom in Rails 3 so I can add what ever actions I want with as little hassle as possible? Is there a way to do this instead of having to declare it per action. -- 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-/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 18 December 2010 16:42, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> How do I regain freedom in Rails 3 so I can add what ever actions I want > with as little hassle as possible? Is there a way to do this instead of > having to declare it per action.Have a look at the Rails Guide on routing. You have not really explained what you are trying to do but I am guessing that section 3.1 may be what you want. Colin -- 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.
Colin Law wrote in post #969281:> > Have a look at the Rails Guide on routing. You have not really > explained what you are trying to do but I am guessing that section > 3.1 may be what you want. > > ColinI would like to be able to add any action I want. If I add a resources :test and have a controller called test and an action test I get "The action ''show'' could not be found for TestController" -- 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-/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.
Paul Bergstrom wrote in post #969317:> Colin Law wrote in post #969281: > >> >> Have a look at the Rails Guide on routing. You have not really >> explained what you are trying to do but I am guessing that section >> 3.1 may be what you want. >> >> Colin > > > I would like to be able to add any action I want. If I add a resources > :test and have a controller called test and an action test I get "The > action ''show'' could not be found for TestController"Is test a reserved word in Rails 3? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser wrote in post #969319:> Paul Bergstrom wrote in post #969317:> Is test a reserved word in Rails 3? >? -- 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-/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.
How do I deal with a page called "overview" that displays information from many models at the same time? How do I deal with a page called "me" that displays information about the user? I can see the benefit of routes in a basic database app with list, view, edit, show. But I don''t understand the logic for examples like mine. In my case it will make much more sense for the user to go to a page called "me" than "user/2". -- 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-/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 19 December 2010 09:33, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> How do I deal with a page called "overview" that displays information > from many models at the same time?There does not have to be one to one relationship between controllers and models. A controller can get data from as many models as it likes. You could have an overview controller if that seems appropriate. If the data from the various models is displayed on different areas of the screen then use a partial for each section.> > How do I deal with a page called "me" that displays information about > the user? I can see the benefit of routes in a basic database app with > list, view, edit, show. But I don''t understand the logic for examples > like mine. In my case it will make much more sense for the user to go to > a page called "me" than "user/2".What do you mean ''a page called me''? Do you mean the URL? If so how would you know which user to show for that url? Colin -- 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 19 December 2010 09:33, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> How do I deal with a page called "me" that displays information about > the user? I can see the benefit of routes in a basic database app with > list, view, edit, show. But I don''t understand the logic for examples > like mine. In my case it will make much more sense for the user to go to > a page called "me" than "user/2".# routes.rb map.me ''me'', :controller => ''users'', :action => ''display_current_user'' # UsersController def display_current_user @user = current_user # assuming you do have a current_user method ... [rest of action code] end ...which gives you access to "me_path" and all the other routes helping malarkey. http://api.rubyonrails.org/classes/ActionDispatch/Routing.html -- 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.
Colin Law wrote in post #969381:> What do you mean ''a page called me''? Do you mean the URL? If so how > would you know which user to show for that url?Yes. The url. From the session id. -- 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-/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 19 December 2010 09:45, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #969381: > >> What do you mean ''a page called me''? Do you mean the URL? If so how >> would you know which user to show for that url? > > Yes. The url. From the session id.Does Michael''s post answer that one? Colin -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
strange, what you are asking is easier in rails 3 than 2. http://railscasts.com/episodes/203-routing-in-rails-3 -- 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.
Michael Pavling wrote in post #969380: e called "me" than "user/2".> > # routes.rb > map.me ''me'', :controller => ''users'', :action => ''display_current_user''Should''t that be match? -- 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-/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 20 December 2010 15:23, Paul Bergstrom <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Michael Pavling wrote in post #969380: > e called "me" than "user/2". >> >> # routes.rb >> map.me ''me'', :controller => ''users'', :action => ''display_current_user'' > > Should''t that be match?I wrote it off the top of my head, so you could be right. But it also depends what version of Rails the OP has to what routing commands he can use... but the general gist is that he should be able to achieve what he wants with routes... -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I added this: match '':controller(/:action(/:id(.:format)))'' and it did the trick. I think. -- 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-/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.