Ensure that attr_reader methods in generators are protected.
This commit is contained in:
parent
17bee0dd2f
commit
101a8fa5f8
|
@ -6,10 +6,11 @@ module Rails
|
||||||
#
|
#
|
||||||
module Migration
|
module Migration
|
||||||
def self.included(base) #:nodoc:
|
def self.included(base) #:nodoc:
|
||||||
base.extend ClassMethods
|
base.class_eval do
|
||||||
base.send :attr_reader, :migration_number,
|
extend ClassMethods
|
||||||
:migration_file_name,
|
readers = lambda { attr_reader :migration_number, :migration_file_name, :migration_class_name }
|
||||||
:migration_class_name
|
respond_to?(:no_tasks) ? no_tasks(&readers) : readers.call
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
@ -28,10 +29,6 @@ module Rails
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_migration_number(dirname) #:nodoc:
|
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
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue