Sha256: bafbbef43d2f1f7b1b1d2fd1980aade0ecf6b2fd346f72505ae6fe5c7abe0eaf
Contents?: true
Size: 466 Bytes
Versions: 2
Compression:
Stored size: 466 Bytes
Contents
module ActiveRecord module Enumerations class EnumField attr_reader :name def initialize name @name = name.to_s end def enums_getter name.pluralize end def enums_setter "#{enums_getter}=" end def foreign_key "#{name}_id" end def external_class options = {} (options.delete(:class_name) || name).camelize.constantize end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ar-enums-0.3.1 | lib/enum_field.rb |
ar-enums-0.3.0 | lib/enum_field.rb |