Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/acts_as_lookup.rb
Overview
modify object to allow any class to act like a lookup class
Class Method Summary collapse
-
.acts_as_lookup(options = {}) ⇒ Object
converts the calling class to act like a lookup model.
Class Method Details
.acts_as_lookup(options = {}) ⇒ Object
converts the calling class to act like a lookup model.
NOTE: for now, the values’ name column should not have spaces in it,
for cleanliness, though this can be addressed by gsubbing.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/acts_as_lookup.rb', line 186 def self.acts_as_lookup( = {}) self.extend ActsAsLookupClassMethods .merge!(:sync_with_db => true) unless .include?(:sync_with_db) .merge!(:write_to_db => true) unless .include?(:write_to_db) .merge!(:add_query_methods => false) unless .include?(:add_query_methods) # FUTURE: # :remove_from_db => false, # :shortcut_method_column => :name self. = # lazy initialize? but for now explicitly initialize here self.acts_as_lookup_initialize end |