concept url in category rails

appears as: URL, URLs, url, The URL, url, URLs
Rails 3 in Action

This is an excerpt from Manning's book Rails 3 in Action.

The number at the end of the URL is the unique numerical ID for this purchase. But what does it mean? Let’s look at the view for this show action now, as shown in the following listing.

has_attached_file :asset, :path => (Rails.root + "files/:id").to_s,
                          :url => "/files/:id"

Twitter has a URL such as http://api.twitter.com/1/statuses/public_timeline.json that has the version as the first part of the URL after the site name and then the format as an extension at the end. Github’s is slightly different, with a URL such as http://github.com/api/v2/json/repos/show/rails3book/ticketee having the version prefixed with a v as the second part of the URL, and the format as the part of the URL directly after. The v prefix here makes the version part of the URL clearer to those who are reading it, which is a good thing.

You’re going to borrow ideas from both of these API designs, presenting your API at the base URL of /api/v1 and the format at the end of the URL, like most web requests. Your URLs will look like /api/v1/projects.json, which will be the URL to return a list of projects that the user is able to read. The reason for this versioning is so that you can always provide data that is predictable to your end users. If you wished to change the format of this data, you would create a new version namespace, which is the final thing we look at toward the end of this chapter. Really, these new version numbers can be whatever you wish, with minor versions such as 0.1 being the standard for unstable APIs, and major versions such as 1, v1, or 1.0 being the standard for the stable, fixed APIs.[5]