提交 101a8fa5 编写于 作者: J José Valim

Ensure that attr_reader methods in generators are protected.

上级 17bee0dd
......@@ -6,10 +6,11 @@ module Generators
#
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 @@ def current_migration_number(dirname) #:nodoc:
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册