Skip to content
Browse files

The model generator shouldn't throw warnings when using mass nouns [#…

…5363 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent fbaf3a2 commit 154e5d735efcc840c3be52a19b1f8a89eeb2e9e9 @jeffkreeftmeijer jeffkreeftmeijer committed with josevalim Oct 14, 2010
View
2 railties/lib/rails/generators/resource_helpers.rb
@@ -17,7 +17,7 @@ def self.included(base) #:nodoc:
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
5 railties/test/generators/resource_generator_test.rb
@@ -73,6 +73,11 @@ def test_plural_names_can_be_forced
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

0 comments on commit 154e5d7

Please sign in to comment.
Something went wrong with that request. Please try again.