README.md in affairs_of_state-0.0.4 vs README.md in affairs_of_state-0.0.5
- old
+ new
@@ -36,11 +36,17 @@
Or give it a long list of statuses:
affairs_of_state :ordered, :cancelled, :shipped, :lost, :in_transit
+You can also pass a proc or a method name symbol to the :if option to bypass validation:
+ affairs_of_state :active, :inactive, :if => lambda{|object| only_validate_if_this_is_true(object) }
+ # or
+ affairs_of_state :active, :inactive, :if => :only_validate_if_this_method_returns_true
+
+
## 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:
widget = Widget.first
@@ -52,10 +58,10 @@
Widget::STATUES # -> ["active", "cancelled"]
It also provides scopes automagically:
Widget.active
-
+
Widget.cancelled
## "But I want callbacks and validations and other things."