Module: SimplyStored::ClassMethods::Base
- Included in:
- SimplyStored::Couch::ClassMethods
- Defined in:
- lib/simply_stored/class_methods_base.rb
Instance Method Summary collapse
- #_find_property(name) ⇒ Object
- #attr_accessible(*args) ⇒ Object
- #attr_protected(*args) ⇒ Object
- #foreign_key ⇒ Object
- #foreign_property ⇒ Object
- #get_class_from_name(klass_name) ⇒ Object
Instance Method Details
#_find_property(name) ⇒ Object
26 27 28 |
# File 'lib/simply_stored/class_methods_base.rb', line 26 def _find_property(name) properties.find{|property| property.name == name} end |
#attr_accessible(*args) ⇒ Object
21 22 23 24 |
# File 'lib/simply_stored/class_methods_base.rb', line 21 def attr_accessible(*args) @_accessible_attributes ||= [] @_accessible_attributes += args.to_a end |
#attr_protected(*args) ⇒ Object
16 17 18 19 |
# File 'lib/simply_stored/class_methods_base.rb', line 16 def attr_protected(*args) @_protected_attributes ||= [] @_protected_attributes += args.to_a end |
#foreign_key ⇒ Object
8 9 10 |
# File 'lib/simply_stored/class_methods_base.rb', line 8 def foreign_key name.underscore.gsub('/','__').gsub('::','__') + "_id" end |
#foreign_property ⇒ Object
12 13 14 |
# File 'lib/simply_stored/class_methods_base.rb', line 12 def foreign_property name.underscore.gsub('/','__').gsub('::','__') end |
#get_class_from_name(klass_name) ⇒ Object
4 5 6 |
# File 'lib/simply_stored/class_methods_base.rb', line 4 def get_class_from_name(klass_name) klass_name.to_s.gsub('__','/').classify.constantize end |