I have few actions (Suppose a, b and c) in my controller (Suppose cont).. When i type them in url like http://localhost/cont/a or b or c its all Ok .. But when i type http://localhost/cont/d or e .. Giving error .. What to change in routes.rb to tackle.. I want to show an landing page in case of buggy URL .. Also if i type http://localhost/cont/a123 then also it should take me to the landing page(Buggy Url page) before_filter is for something else .. rit .. May be an beginner question but do now know how to tackle .. :) -- Posted via http://www.ruby-forum.com/.
Is''nt there anyone who can help me get rid out of this .. Hemant Bhargava wrote:> I have few actions (Suppose a, b and c) in my controller (Suppose > cont).. > When i type them in url like http://localhost/cont/a or b or c its all > Ok .. > But when i type http://localhost/cont/d or e .. Giving error .. > What to change in routes.rb to tackle.. I want to show an landing page > in case of buggy URL .. > Also if i type http://localhost/cont/a123 then also it should take me to > the landing page(Buggy Url page) > > before_filter is for something else .. rit .. > May be an beginner question but do now know how to tackle .. :)-- Posted via http://www.ruby-forum.com/.
Hemant Bhargava wrote:> Is''nt there anyone who can help me get rid out of this ..You''re bumping after less than 2 hours? Why? That will just annoy the people who could help you.> > > Hemant Bhargava wrote: >> I have few actions (Suppose a, b and c) in my controller (Suppose >> cont).. >> When i type them in url like http://localhost/cont/a or b or c its all >> Ok .. >> But when i type http://localhost/cont/d or e .. Giving error .. >> What to change in routes.rb to tackle.. I want to show an landing page >> in case of buggy URL .. >> Also if i type http://localhost/cont/a123 then also it should take me to >> the landing page(Buggy Url page) >> >> before_filter is for something else .. rit .. >> May be an beginner question but do now know how to tackle .. :)-- Posted via http://www.ruby-forum.com/.
Ok sorry, I did''nt know the rules .. Sorry again.. but i need it urgent actually .. :) Marnen Laibow-Koser wrote:> Hemant Bhargava wrote: >> Is''nt there anyone who can help me get rid out of this .. > > You''re bumping after less than 2 hours? Why? That will just annoy the > people who could help you. >-- Posted via http://www.ruby-forum.com/.
Hemant Bhargava wrote:> Ok sorry, I did''nt know the rules .. > Sorry again.. but i need it urgent actually .. :)Then go read the routing documentation. In general, try not to ask the list until you''ve read the docs. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Hemant Bhargava wrote:> Ok sorry, I did''nt know the rules .. > Sorry again.. but i need it urgent actually .. :) >Routes are eval''ed from top to bottom as defined, first match wins. Sounds like you need a catch-all route at the bottom of routes.rb that sends the user to your ''buggy url'' page if no other route matched the request. There are a number of good tutorials out there for routing in Rails, and perhaps http://api.rubyonrails.org/classes/ActionController/Routing.html is a good place to start. And I second Marnen. Your emergency is your emergency, not anyone else''s. And people may be more apt to respond to a post that states the issue and what you have tried to resolve it, or the research you have done. Otherwise the request for help comes across as ''Someone fix this for me, I want/need it'' -- Posted via http://www.ruby-forum.com/.
2009/9/2 Hemant Bhargava <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > I have few actions (Suppose a, b and c) in my controller (Suppose > cont).. > When i type them in url like http://localhost/cont/a or b or c its all > Ok .. > But when i type http://localhost/cont/d or e .. Giving error .. > What to change in routes.rb to tackle.. I want to show an landing page > in case of buggy URL .. > Also if i type http://localhost/cont/a123 then also it should take me to > the landing page(Buggy Url page) > > before_filter is for something else .. rit .. > May be an beginner question but do now know how to tackle .. :)If I understand the question correctly you want to go to a particular page when the user enters an invalid controller or action? When running in production mode this, by default, displays the page public/404.html. You can make this page display what you like. Is that what you are looking for? Colin
Dear Hemant, First thing, please do read routes guide, and preferably a rails book. it will help you understand things better. But as far your question goes, your are seeing error because your are running your app in development mode. Try running it in production mode, and you will see a 404 page (present here: public/404.html) Customize it as you want. Lastly, please be patient when you are expecting others to solve your problems, and yes, Google always help. So use it. -- Abhinav http://twitter.com/abhinav On Wed, Sep 2, 2009 at 4:43 PM, Hemant Bhargava < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I have few actions (Suppose a, b and c) in my controller (Suppose > cont).. > When i type them in url like http://localhost/cont/a or b or c its all > Ok .. > But when i type http://localhost/cont/d or e .. Giving error .. > What to change in routes.rb to tackle.. I want to show an landing page > in case of buggy URL .. > Also if i type http://localhost/cont/a123 then also it should take me to > the landing page(Buggy Url page) > > before_filter is for something else .. rit .. > May be an beginner question but do now know how to tackle .. :) > -- > 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 -~----------~----~----~----~------~----~------~--~---
2009/9/2 Ar Chron <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Hemant Bhargava wrote: >> Ok sorry, I did''nt know the rules .. >> Sorry again.. but i need it urgent actually .. :) >> > > Routes are eval''ed from top to bottom as defined, first match wins. > Sounds like you need a catch-all route at the bottom of routes.rb that > sends the user to your ''buggy url'' page if no other route matched the > request. > > There are a number of good tutorials out there for routing in Rails, and > perhaps > > http://api.rubyonrails.org/classes/ActionController/Routing.htmlAn alternative place to start (maybe better for a beginner) is the routing guide at http://guides.rubyonrails.org/ After the getting started guide of course and others. Colin> > is a good place to start. > > And I second Marnen. Your emergency is your emergency, not anyone > else''s. And people may be more apt to respond to a post that states the > issue and what you have tried to resolve it, or the research you have > done. Otherwise the request for help comes across as ''Someone fix this > for me, I want/need it'' > > > -- > Posted via http://www.ruby-forum.com/. > > > >
Thanks a lot guyz for your support .. Found my solutions .. In catch all routes ..I gave some requirements in my routes matching .. Thanks again .. Colin Law wrote:> 2009/9/2 Ar Chron <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >> >> There are a number of good tutorials out there for routing in Rails, and >> perhaps >> >> http://api.rubyonrails.org/classes/ActionController/Routing.html > > An alternative place to start (maybe better for a beginner) is the > routing guide at http://guides.rubyonrails.org/ After the getting > started guide of course and others. > > Colin-- Posted via http://www.ruby-forum.com/.
Actually true .. :) But i found its solution in development mode also .. Colin Law wrote:> 2009/9/2 Hemant Bhargava <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >> >> before_filter is for something else .. rit .. >> May be an beginner question but do now know how to tackle .. :) > > If I understand the question correctly you want to go to a particular > page when the user enters an invalid controller or action? When > running in production mode this, by default, displays the page > public/404.html. You can make this page display what you like. Is > that what you are looking for? > > Colin-- Posted via http://www.ruby-forum.com/.