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

Version Path
rails_csi-2.3.5.p8 lib/rails_generator/generators/components/migration/migration_generator.rb
rails_csi-2.3.5.p7 lib/rails_generator/generators/components/migration/migration_generator.rb
rails_csi-2.3.5.p6 lib/rails_generator/generators/components/migration/migration_generator.rb
webroar-0.5.0 src/admin_panel/vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.2.4 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.2.2 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.2.1 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.2 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1.9 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1.8 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1.7 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1.6 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1.5 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1.4 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1.3 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1.2 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1.1 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiantcms-couchrest_model-0.1 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
radiant-0.7.2 vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb
vibes-bj-1.2.2 spec/rails_root/vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb