Class: Document
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Document
- Defined in:
- app/models/document.rb
Constant Summary collapse
- DOCUMENT_DYNAMIC_ATTRIBUTE_PREFIX =
'dyn_'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.add_dyn_prefix(field) ⇒ Object
14 15 16 |
# File 'app/models/document.rb', line 14 def add_dyn_prefix(field) "#{DOCUMENT_DYNAMIC_ATTRIBUTE_PREFIX}#{field}" end |
.remove_dyn_prefix(field) ⇒ Object
18 19 20 |
# File 'app/models/document.rb', line 18 def remove_dyn_prefix(field) field.gsub(DOCUMENT_DYNAMIC_ATTRIBUTE_PREFIX, '') end |
Instance Method Details
#set_dyn_attribute(field, value) ⇒ Object
23 24 25 |
# File 'app/models/document.rb', line 23 def set_dyn_attribute(field, value) self.send("#{Document.add_dyn_prefix(field)}=", value) end |