提交 b8c34d1a 编写于 作者: Y yuuji.yaginuma

move `db_migrate_path` method to `Migration` module

Since `Migration` module is included in both `MigrationGenerator` and
`ModelGenerator`, no need to define a common method for each class.
上级 fb5bd3c6
......@@ -20,6 +20,14 @@ def primary_key_type
key_type = options[:primary_key_type]
", id: :#{key_type}" if key_type
end
def db_migrate_path
if defined?(Rails) && Rails.application
Rails.application.config.paths["db/migrate"].to_ary.first
else
"db/migrate"
end
end
end
end
end
......@@ -71,14 +71,6 @@ def validate_file_name!
def normalize_table_name(_table_name)
pluralize_table_names? ? _table_name.pluralize : _table_name.singularize
end
def db_migrate_path
if defined?(Rails) && Rails.application
Rails.application.config.paths["db/migrate"].to_ary.first
else
"db/migrate"
end
end
end
end
end
......@@ -64,14 +64,6 @@ def application_record_file_name
"app/models/application_record.rb"
end
end
def db_migrate_path
if defined?(Rails) && Rails.application
Rails.application.config.paths["db/migrate"].to_ary.first
else
"db/migrate"
end
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册