diff options
-rw-r--r-- | activemodel/lib/active_model/dirty.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/generators.rb | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb index 614bc6a5d8..977cccf5d0 100644 --- a/activemodel/lib/active_model/dirty.rb +++ b/activemodel/lib/active_model/dirty.rb @@ -26,6 +26,10 @@ module ActiveModel # # define_attribute_methods :name # + # def initialize(name = nil) + # @name = name + # end + # # def name # @name # end @@ -54,7 +58,7 @@ module ActiveModel # # A newly instantiated object is unchanged: # - # person = Person.find_by(name: 'Uncle Bob') + # person = Person.new 'Uncle Bob' # person.changed? # => false # # Change the name: diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index e25c364178..db8b184213 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -156,7 +156,7 @@ module Rails args << "--help" if args.empty? && klass.arguments.any?(&:required?) klass.start(args, config) else - options = sorted_groups.map(&:last).flatten + options = sorted_groups.flat_map(&:last) suggestions = options.sort_by {|suggested| levenshtein_distance(namespace.to_s, suggested) }.first(3) msg = "Could not find generator '#{namespace}'. " msg << "Maybe you meant #{ suggestions.map {|s| "'#{s}'"}.join(" or ") }\n" @@ -286,7 +286,7 @@ module Rails d[m] = x end - return x + x end # Prints a list of generators. |