Module: HumanID::Migration
- Included in:
- ActiveRecord::ConnectionAdapters::TableDefinition
- Defined in:
- lib/humanid/migration.rb
Instance Method Summary collapse
-
#alias(*args) ⇒ Object
Commonly used.
- #human_id(*args) ⇒ Object
Instance Method Details
#alias(*args) ⇒ Object
Commonly used
18 19 20 21 |
# File 'lib/humanid/migration.rb', line 18 def alias(*args) args << :alias if args.empty? || args.first.kind_of?(Hash) human_id(*args) end |
#human_id(*args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/humanid/migration.rb', line 6 def human_id(*args) = args. [:index] = case [:index] when true then { unique: true } when false then false else ([:index] || {}).reverse_merge!(unique: true) end args.each { |name| column(name, :string, ) } end |