Skip to content

romatr/stringified_enum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StringifiedEnum

How to use?

in your Gemfile

gem "stringified_enum"

in you ActiveRecord model

class Item < ApplicationRecord
  include StringifiedEnum

  stringified_enum status: %i(active inactive)
end

How does it work?

It works as a shortcut for the original ActiveRecord::Enum definition. For example the code above is equivalent to:

class Item < ApplicationRecord
  enum status: { active: "active", inactive: "inactive" }
end

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages