Gistflow

  • login

routes

Nothing to display jet.

History
Show

Split massive rails routes.rb into understandable separate files by divineforest

Be91a535ad5acb3bb34f16401d850658?size=52

For example by namespace. Just create new folder for #routes config/routes/ and tell #rails to include it:

config.paths["config/routes"] += Dir[Rails.root.join("config/routes/*.rb")]

Then you can create files like this:

# config/routes/admin.rb
Pilot::Application.routes.draw do
  namespace :admin do
    resources :posts
  end
end
March 13, 2013
Tweet
0

Checking routes in Rails by makaroni4

E302c3320cd14b02cbe237b479d7f884?size=52

How do we usually check the routes in #rails application? We are accustomed to use rake routes command in terminal but there are actually couple tricks. More under the cut

July 6, 2012
Tweet
2

Plural model names in Rails by releu

757fb0d5ec7560b6f25f5bd98eadc020?size=52

If you have a plural model name you should add underscored name to uncountable array in inflections.rb for create right #routes.

# inflections.rb
ActiveSupport::Inflector.inflections do |inflect|
  inflect.uncountable %w(news)
end

# routes.rb
resources :news

Now #rails won't singular model in members actions.

http://api.rubyonrails.org/classes/ActiveSupport/Inflector/Inflections.html

May 14, 2012
Tweet
2

About

Join gistflow developers community

  • Start your developer blog in a minute.
  • Share code-related posts.
  • Follow users, subscribe for tags.
  • Use gist.github.com gists to write posts.

Sign up through GitHub

Tell friends about us

Tags

  • #ruby
  • #rails
  • #gistflow
  • #javascript
  • #activerecord
  • #gem
  • #git
  • #bash
  • #mac
  • #html
  • #shell
  • #rspec
  • #coffeescript
  • #github
  • #capistrano
  • Posts leaderboard
  • Tags cloud
  • Create issue
  • Email us
<g>

© 2013 Gistflow with Evrone