# Quick Tip: Override Rails Generated URLs

> Override the default Ruby on Rails generated URLs for a resource. It is a quick and simple way to change your URLs without changing your code.

- Author: Curtis Miller
- Published: 2009-07-20
- Categories: rails, how-to
- Canonical URL: https://millarian.com/posts/quick-tip-override-rails-generated-urls/

By default Ruby on Rails resources use the controller name for the URL. For example:

```
map.resources :time_entries
```

would yield the following URLs

[Code sample on GitHub Gist](https://gist.github.com/151034)

What if you want them to be something else entirely? I guess you could rename your controller, update your routes.rb file and everywhere you use a URL helper... or, **just use the "as" modifier**!

```
map.resources :time_entries, :as => :time
```

now yields the following URLs

[Code sample on GitHub Gist](https://gist.github.com/151040)

**All of your existing uses of the URL helpers can remain the same and it will generate all URLs correctly. Quick, simple and painless!**

## References

- Module ActionController::Resources (dead link: http://api.rubyonrails.org/classes/ActionController/Resources.html#M000522)
