mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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:
committed by
José Valim
parent
fbaf3a23d9
commit
154e5d735e
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user