README.md in affairs_of_state-0.6.0 vs README.md in affairs_of_state-0.7.0
- old
+ new
@@ -58,11 +58,11 @@
or
```ruby
affairs_of_state :active, :inactive, if: :only_validate_if_this_method_returns_true
```
-Currently it is limited only be called once per model.
+It can be called multiple times per model, provided as each time is with a different column, and that none of the statuses overlap. If either of these are not true it will raise on load.
## Methods
The gem provides methods for checking and setting your status. The question mark method returns a boolean, and the bang method changes to that status. Lets assume you have "active" and "cancelled" as defined status:
@@ -70,26 +70,28 @@
```ruby
widget = Widget.first
widget.cancelled! if widget.active?
```
-You can also access all your statuses on the model like so:
+You can also access all your statuses on the model. If only one is defined it is default, otherwise the column name needs to be passed in:
```ruby
-Widget::STATUSES # -> ["active", "cancelled"]
+Widget.statuses # -> ["active", "cancelled"]
+Widget.statuses(:status) # -> ["active", "cancelled"]
```
It also provides scopes automagically:
```ruby
Widget.active
Widget.cancelled
```
-For select inputs in forms there is a convenience method that returns all states in the format expected by `options_for_select`
+For select inputs in forms there is a convenience method that returns all states in the format expected by `options_for_select`. Again if only one is defined on the model it returns as default, if multiple are defined the column name needs to be passed in:
```ruby
<%= f.select :status, options_for_select(Widget.statuses_for_select) %>
+<%= f.select :status, options_for_select(Widget.statuses_for_select(:status)) %>
```
## "But I want callbacks and validations etc."