The model generator shouldn't throw warnings when using mass nouns [#5363 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Jeff Kreeftmeijer
2010-10-14 21:23:19 +02:00
committed by José Valim
parent fbaf3a23d9
commit 154e5d735e
2 changed files with 6 additions and 1 deletions

View File

@@ -17,7 +17,7 @@ module Rails
def initialize(*args) #:nodoc:
super
if name == name.pluralize && !options[:force_plural]
if name == name.pluralize && name.singularize != name.pluralize && !options[:force_plural]
unless ResourceHelpers.skip_warn
say "Plural version of the model detected, using singularized version. Override with --force-plural."
ResourceHelpers.skip_warn = true

View File

@@ -73,6 +73,11 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
assert_no_match /Plural version of the model detected/, content
end
def test_mass_nouns_do_not_throw_warnings
content = run_generator ["sheep".freeze]
assert_no_match /Plural version of the model detected/, content
end
def test_route_is_removed_on_revoke
run_generator
run_generator ["account"], :behavior => :revoke