Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


customize rails URL

Posted on 2011-09-20
Medium Priority
Last Modified: 2012-05-12
so lets say this is my show page from the story resource:


how do i change "stories" to something else?

i already have this for the index page: '/news', :controller => 'stories', :action => 'index'

Question by:depassion
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 10

Expert Comment

by:Andrew Doades
ID: 36567741
Something like this, this is a real route from one of my current rails apps.
It means I can navigate to http://server/download_video/387  and download video "387" for example.

map.doclink '/download_video/:id', :controller => 'customer/sub_categories', :action => 'doclink2'


Author Comment

ID: 36567790

map.articleshow '/news/:id', :controller => 'stories', :action => 'show'

it doesn't work for me
LVL 10

Expert Comment

by:Andrew Doades
ID: 36567808
Hmm.. what's the field name where "aerovironment-wins-84-million-order-for-digital-raven-uavs" comes from?
I'll then do some testing on a local app (unless someone steps in first :) )

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 36567827
thats from a plugin called friendly_id

gem "friendly_id", "3.1.7"

Author Comment

ID: 36567871
it just takes the heading of the story

t.string   "heading"

and in the story model:

has_friendly_id :heading, :use_slug => true

Accepted Solution

kristinalim earned 2000 total points
ID: 36585364
It looks like you already have a collection resource set up. It probably looks like this:
map.resources :stories

Open in new window

What version of rails are you using? It doesn't look like it's Rails 3.x. In 2.3.8, you can use the :as option to specify the name generated and recognized in the URL. See the Rails 2.3.8 API, search for "resources" (ActionController::Resources) for more information.
map.resources :stories, :as => 'news'

Open in new window

In a much earlier version, if I remember correctly, it's the :opaque_name option.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: narshlob
If you've ever programmed in Ruby and have come across either a proc or a lambda, you might have been wondering what the difference is between the two and when you would use one over the other. This article will try to explain the difference between…
In Ruby, Call or invoke a API DLL library is easily via Win32API class, win32-api gem or other gems. For general DLL API call, there are quite a few references, some good tips list below:…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question