README.rdoc in enumerate_it-0.7.16 vs README.rdoc in enumerate_it-0.7.17
- old
+ new
@@ -1,7 +1,9 @@
= EnumerateIt - Ruby Enumerations
+{<img src="https://secure.travis-ci.org/cassiomarques/enumerate_it.png?branch=master" alt="Build Status" />}[http://travis-ci.org/cassiomarques/enumerate_it]
+
Author: Cássio Marques - cassiommc at gmail
== Description
Ok, I know there are a lot of different solutions to this problem. But none of them solved my problem,
@@ -158,9 +160,21 @@
p = Person.new
p.relationship_status = RelationshipStatus::MARRIED
p.married? #=> true
p.divorced? #=> false
+
+* It's also possible to "namespace" the created helper methods, passing a hash to the :create_helpers option.
+ This can be useful when two or more of the enumerations used share the same constants.
+
+ class Person < ActiveRecord::Base
+ has_enumeration_for :relationship_status, :with => RelationshipStatus, :create_helpers => { :prefix => true }
+ end
+
+ p = Person.new
+ p.relationship_status = RelationshipStatus::MARRIED
+ p.relationship_status_married? #=> true
+ p.relationship_status_divoced? #=> false
* The :create_helpers also creates some mutator helper methods, that can be used to change the attribute's value.
class Person < ActiveRecord::Base
has_enumeration_for :relationship_status, :with => RelationshipStatus, :create_helpers => true