rails_look_up_table

This is a simple gem which caters for look up tables in rails, the fact that look up tables don’t really hold relationships is the reason this gem exists.

Once the gem is installed all one need to do to use it is call the lookup method in the model which uses the lookup table passing in the the model name that represents the lookup table eg.

Class Person < ActiveRecord::Base

lookup :status

end

The following features will be provided:

  • Boolean methods on the different lookup fields eg. @person.pending?

  • Setter and Getter fields for lookup object eg. @person.status = :pending, @pending or ‘pending’

    • Adding new values will generate all methods required for new records

  • Also includes dirty fields for newly added fields

  • Adds scopes to get the collection records in different lookup values eg. Person.pendings

Contributing to rails_look_up_table

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2013 Paul Janse van Rensburg. See LICENSE.txt for further details.