Kees Sonnema
Kees Sonnema

Reputation: 5784

Rails 3.2 puts 's' behind generated scaffold

I'm wondering if i can generate a scaffold without getting that annyoing s after all scaffolds.

For example, when I run rails generate scaffold product, rails generates a scaffold called products.

Upvotes: 1

Views: 354

Answers (2)

Nate
Nate

Reputation: 16898

You can modify config/initializers/inflections.rb and provide custom Inflections for words that you want to pluralize/singularize differently. Something like:

ActiveSupport::Inflector.inflections do |inflect|
  inflect.uncountable "product"
end

would make it so rails g scaffold Product ... wouldn't pluralize the table name and controller name.

However, I would advise against doing this en masse, or just because you don't like pluralization. One of Rails strengths is "Convention over Configuration", and like in several cases, if you're not following the convention, it will be more trouble than it's worth in the long run.

Upvotes: 3

tiktak
tiktak

Reputation: 1811

May be you should think about changing your config/initializers/inflections.rb file. Learn more by links below:

Upvotes: 1

Related Questions