Sha256: 8e6842e02a4bf48c8c221ab01c92b8796cba331fee45e19e755051bfa9f417e2

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

class User < ActiveRecord::Base
  extend RailsAttrEnum

  # attr_enum :role, :admin, :author, :editor, :user
  # attr_enum :role, :admin, { author: 2 }, :editor, { user: 10 }

  attr_enum :role, { admin: { value: 10, label: 'ADMIN' } },
                   { author: 'Author Role' },
                   :editor,
                   { user: { label: 'ID10T', value: 45 } }

  # attr_enum :role, {
  #   admin: 'ADMIN',
  #   author: 'AUTHOR',
  #   editor: 'EDITOR',
  #   user: 'ID10T'
  # }

  # attr_enum :role do
  #   add admin: 1
  #   add :author
  #   add editor: 42
  #   add user: 7
  # end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_attr_enum-0.0.3 test/dummy/app/models/user.rb