README.md in has_enum-0.4.0 vs README.md in has_enum-0.5.0
- old
+ new
@@ -16,17 +16,21 @@
## Usage
### Models
Here's example model:
class TestModel < ActiveRecord::Base
has_enum :category, %w( stuff things misc )
- has_enum :color , %w( red green blue )
+ has_enum :color , %w( red green blue ) , :scopes => true
has_enum :size , %w( small medium large ) , :query_methods => false
has_enum :status , [:pending, :failed, :done]
end
Query methods are available by default. For example, query methods for color enum this methods will be available:
color_green?
color_red?
color_blue?
+If you set *:scopes => true* these scopes will be available:
+ color_green
+ color_red
+ color_blue
See [sample usage in specs](https://github.com/openteam/has_enum/blob/master/spec/has_enum_spec.rb).
### Views
radio_button_enum(object_name, method, options = {})
select_enum(object_name, method, options = {})