Sha256: b9a638c6e68818a060a80a61f93a06f3b2e68bccc715bc6c0de1dcd39767ec67
Contents?: true
Size: 515 Bytes
Versions: 74
Compression:
Stored size: 515 Bytes
Contents
class MigrationGenerator < Rails::Generator::NamedBase def manifest record do |m| m.migration_template 'migration.rb', 'db/migrate', :assigns => get_local_assigns end end private def get_local_assigns returning(assigns = {}) do if class_name.underscore =~ /^(add|remove)_.*_(?:to|from)_(.*)/ assigns[:migration_action] = $1 assigns[:table_name] = $2.pluralize else assigns[:attributes] = [] end end end end
Version data entries
74 entries across 73 versions & 13 rubygems