README.rdoc in enumerate_it-1.0.0 vs README.rdoc in enumerate_it-1.0.1

- old
+ new

@@ -37,14 +37,10 @@ And, more than this, referencing them in my code using magic numbers was terrible and meaningless: What does it mean when we say that someone or something is '2'? Enter EnumerateIt. -== Documentation - -http://rubydoc.info/gems/enumerate_it/1.0.0/frames - == About versions compatibility Versions 1.x.x are NOT backwards compatible with 0.x.x versions. The biggest difference is that on 1.0.0 you need to `extend` the EnumerateIt module inside classes that are going to have enumerated attributes, while in past versions you would use `include`. @@ -266,16 +262,18 @@ gem install enumerate_it == Using with Rails -* Create an initializer with the following code: +* Add the gem to your Gemfile: - ActiveRecord::Base.extend EnumerateIt + gem "enumerate_it" -* Add the 'enumerate_it' gem as a dependency in your environment.rb (Rails 2.3.x) or Gemfile (if you're using Bundler) +* Run the install generator: + rails g enumerate_it:install + An interesting approach to use it in Rails apps is to create an app/enumerations folder and add it to your autoload path in config/application.rb: module YourApp class Application < Rails::Application config.autoload_paths << "#{Rails.root}/app/enumerations" @@ -283,26 +281,9 @@ end There is also a Rails Generator that you can use to generate enumerations and their locale files. Take a look at how to use it running rails generate enumerate_it --help - -== Ruby 1.9 - -EnumerateIt is fully compatible with Ruby 1.9.1 and 1.9.2 (all tests pass) - -* Note: on ruby 1.9.2, if you are using the enumerations in a separate folder like app/models/enumerations, and have to use the :with parameter, you have to clear the enum class namespace to a global scope by using ::EnumClass instead of EnumClass: - - # 1.8.7 - class Person < ActiveRecord::Base - has_enumeration_for :relationship_status, :with => EnumClass - end - - # 1.9.2 - class Person < ActiveRecord::Base - has_enumeration_for :relationship_status, :with => ::EnumClass - end - == Why did you reinvent the wheel? There are other similar solutions to the problem out there, but I could not find one that worked both with strings and integers as the enumerations' codes. I had both situations in