Sha256: 817de1b63f1abaeef1383d1f032d85791d3957f13f5beff7055317d1afeaf73e

Contents?: true

Size: 503 Bytes

Versions: 2

Compression:

Stored size: 503 Bytes

Contents

class MigrationGroongaGenerator < Rails::Generator::NamedBase
  def manifest
    record do |m|
      m.migration_template 'migration.rb', 'db/groonga/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

2 entries across 2 versions & 1 rubygems

Version Path
activegroonga-0.0.7 rails_generators/migration_groonga/migration_groonga_generator.rb
activegroonga-0.0.6 rails_generators/migration_groonga/migration_groonga_generator.rb