README.md in str_enum-0.1.1 vs README.md in str_enum-0.1.2

- old
+ new

@@ -14,13 +14,19 @@ ```ruby gem 'str_enum' ``` -In your models, use: +Add a string column to your model. ```ruby +add_column :users, :status, :string +``` + +And use: + +```ruby class User < ActiveRecord::Base str_enum :status, [:active, :archived] end ``` @@ -45,20 +51,26 @@ ```ruby user.active? user.archived? ``` +#### Forms + +```erb +<%= f.select :status, User.statuses.map { |s| [s.titleize, s] } %> +``` + ## Options Choose which features you want with: ```ruby class User < ActiveRecord::Base str_enum :status, [:active, :archived], scopes: false, validate: false, accessor_methods: false end ``` -Prevent name collisions with the `prefix` option. +Prevent method name collisions with the `prefix` option. ```ruby class User < ActiveRecord::Base str_enum :address_status, [:active, :archived], prefix: :address end