It's been a while since I've used rails (used 2.* a fair bit) and I'm
getting back into it again.
I've noticed something strange with the routes file - when I generate a
controller with the usual 7 actions, routes.rb is flooded with get
patterns.

Is this normal?

For crud controllers that hava a model behind them, I've been removing
them and adding "resource :controller-name" instead - is this
usual(best) practice? What's the the current recommended approach?

many thanks for reading.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Tim Shaffer at Jan 20, 2012 at 6:44 pm
    It depends how you generate the controller. If you use a command like this:

    rails g controller posts index show edit new update create destroy

    It will indeed create a GET route for each action. Kind of annoying.

    You can generate the restful controller and route declaration by using the
    following:

    rails g resource post

    But of course this will also attempt to create the migration and model
    files, which may not be desired. You can add the -s option to skip files
    that already exist.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/SSFIXYf9U94J.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 20, '12 at 1:05p
activeJan 20, '12 at 6:44p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Paul Olivers: 1 post Tim Shaffer: 1 post

People

Translate

site design / logo © 2021 Grokbase