What to change/write in routes.rb ..?

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 … :slight_smile:

Is’nt there anyone who can help me get rid out of this …

Hemant B. 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 … :slight_smile:

Hemant B. 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 B. 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 … :slight_smile:

Ok sorry, I did’nt know the rules …
Sorry again… but i need it urgent actually … :slight_smile:

Marnen Laibow-Koser wrote:

Hemant B. 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 B. wrote:

Ok sorry, I did’nt know the rules …
Sorry again… but i need it urgent actually … :slight_smile:

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
[email protected]

Hemant B. wrote:

Ok sorry, I did’nt know the rules …
Sorry again… but i need it urgent actually … :slight_smile:

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’

2009/9/2 Ar Chron [email protected]:

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

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 L. wrote:

2009/9/2 Ar Chron [email protected]:

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

2009/9/2 Hemant B. [email protected]:

before_filter is for something else … rit …
May be an beginner question but do now know how to tackle … :slight_smile:

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

Actually true … :slight_smile:
But i found its solution in development mode also …

Colin L. wrote:

2009/9/2 Hemant B. [email protected]:

before_filter is for something else … rit …
May be an beginner question but do now know how to tackle … :slight_smile:

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 B. <