instance method
migration_template
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
migration_template(relative_source, relative_destination, template_options = {})
When deleting a migration, it knows to delete every file named “[0-9]*_#{file_name}”.
Parameters
-
relative_sourcereq -
relative_destinationreq -
template_optionsopt = {}
Source
# File railties/lib/rails_generator/commands.rb, line 512
def migration_template(relative_source, relative_destination, template_options = {})
migration_directory relative_destination
migration_file_name = template_options[:migration_file_name] || file_name
unless migration_exists?(migration_file_name)
puts "There is no migration named #{migration_file_name}"
return
end
existing_migrations(migration_file_name).each do |file_path|
file(relative_source, file_path, template_options)
end
end
Defined in railties/lib/rails_generator/commands.rb line 512
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generator::Commands::Destroy