Skip to content

Instantly share code, notes, and snippets.

@lin
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save lin/e30d9ada0f74c7f2919e to your computer and use it in GitHub Desktop.

Select an option

Save lin/e30d9ada0f74c7f2919e to your computer and use it in GitHub Desktop.
Rails API

1, edit the /etc/hosts file

127.0.0.1       api.localhost

2, routes.rb

namespace :api, path: '', constrains: { subdomain: 'api' } do
  resources :users
end

3, inflections.rb

ActiveSupport::Inflector.inflections(:en) do |inflect|
  inflect.acronym 'API'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment