Hi Is there a way to use map.resources in routes for a controller, but without including the create or new actions? Cheers --~--~---------~--~----~------------~-------~--~----~ 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 Daniel, As far as I understand it, all you have to do is not define the create and new action in your controller. If those actions are not defined in the controller AND there are no "new.rhtml" and "create.rhtml" in the views folder, I think it will behave like you want to. HTH ~Rohith On 4/23/07, Daniel N <has.sox-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi > > Is there a way to use > map.resources > in routes for a controller, but without including the create or new > actions? > > Cheers > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Daniel ----- wrote:> Hi > > Is there a way to use > map.resources > in routes for a controller, but without including the create or new > actions? > > CheersIf the controller does not define the methods they will not exist, but by default, rails throws and ugly error message. (well no uglier then if you had misspelled a URL but...) You might instead what to create these methods and simply have them throw a pretty 404 or maybe 401(<- Some REST guru will be able to tell you which code to throw) John -- 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 4/25/07, John Miller <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Daniel ----- wrote: > > Hi > > > > Is there a way to use > > map.resources > > in routes for a controller, but without including the create or new > > actions? > > > > Cheers > > If the controller does not define the methods they will not exist, but > by default, rails throws and ugly error message. (well no uglier then if > you had misspelled a URL but...) You might instead what to create these > methods and simply have them throw a pretty 404 or maybe 401(<- Some > REST guru will be able to tell you which code to throw) > > John > > --I guess it is the nasty Error page that I''m looking to avoid. Thanx for the idea. Cheers Daniel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Couldn''t you just use a before_filter to redirect to ether a nice clean error page or even just use the index action instead? before_filter :show_error, :only => [:new, :create] def show_error redirect_to plural_path() end On Apr 25, 6:56 pm, "Daniel N" <has....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 4/25/07, John Miller <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > > > > Daniel ----- wrote: > > > Hi > > > > Is there a way to use > > > map.resources > > > in routes for a controller, but without including the create or new > > > actions? > > > > Cheers > > > If the controller does not define the methods they will not exist, but > > by default, rails throws and ugly error message. (well no uglier then if > > you had misspelled a URL but...) You might instead what to create these > > methods and simply have them throw a pretty 404 or maybe 401(<- Some > > REST guru will be able to tell you which code to throw) > > > John > > > -- > > I guess it is the nasty Error page that I''m looking to avoid. Thanx for the > idea. > > Cheers > Daniel--~--~---------~--~----~------------~-------~--~----~ 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 4/26/07, Robert Walker <rwalker348-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Couldn''t you just use a before_filter to redirect to ether a nice > clean error page or even just use the index action instead? > > before_filter :show_error, :only => [:new, :create] > > def show_error > redirect_to plural_path() > endReally what I was thinking was to not define routes for non-existant actions. But if I can''t turn some of them off then something like redirection or a nice error will be sufficient. Cheers --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---