diff options
author | José Valim <jose.valim@gmail.com> | 2010-02-02 10:24:31 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-02-02 10:30:28 +0100 |
commit | 101a8fa5f8cbf0f981ca984a279fb9838c79a751 (patch) | |
tree | b9609f466a1b59dac5b4ecf9b5fa377f43e2e6ec /railties/lib/rails/generators | |
parent | 17bee0dd2fcce2d040bd6edda3e19cb11c5813d9 (diff) | |
download | rails-101a8fa5f8cbf0f981ca984a279fb9838c79a751.tar.gz rails-101a8fa5f8cbf0f981ca984a279fb9838c79a751.tar.bz2 rails-101a8fa5f8cbf0f981ca984a279fb9838c79a751.zip |
Ensure that attr_reader methods in generators are protected.
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r-- | railties/lib/rails/generators/migration.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/railties/lib/rails/generators/migration.rb b/railties/lib/rails/generators/migration.rb index 957d695d3a..8a8c899cc1 100644 --- a/railties/lib/rails/generators/migration.rb +++ b/railties/lib/rails/generators/migration.rb @@ -6,10 +6,11 @@ module Rails # module Migration def self.included(base) #:nodoc: - base.extend ClassMethods - base.send :attr_reader, :migration_number, - :migration_file_name, - :migration_class_name + base.class_eval do + extend ClassMethods + readers = lambda { attr_reader :migration_number, :migration_file_name, :migration_class_name } + respond_to?(:no_tasks) ? no_tasks(&readers) : readers.call + end end module ClassMethods @@ -28,10 +29,6 @@ module Rails end def next_migration_number(dirname) #:nodoc: - orm = Rails.configuration.generators.options[:rails][:orm] - require "generators/#{orm}" - "#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname) - rescue raise NotImplementedError end end |