Module: SmartModel::Attributes
- Defined in:
- lib/smart_model/attributes.rb
Class Method Summary collapse
Class Method Details
.included(model) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/smart_model/attributes.rb', line 5 def self.included(model) model.send :include , MongoMapper::Document %w(String Integer Boolean Array ObjectId Date Time).each do |name| model.class_eval " private def self.#{name.downcase}(value , options = {}) key value , #{name}, options end def self.#{name.downcase.pluralize}(values , options = {}) values.each do |val| key val , #{name} , options end end " end end |