Module: SmoothOperator::Persistence::ClassMethods
- Defined in:
- lib/smooth_operator/persistence.rb
Constant Summary collapse
- METHODS_VS_HTTP_VERBS =
{ reload: :get, create: :post, update: :put, destroy: :delete }
Instance Attribute Summary collapse
Instance Method Summary collapse
- #create(attributes = nil, relative_path = nil, data = {}, options = {}) ⇒ Object
- #methods_vs_http_verbs ⇒ Object
Instance Attribute Details
#destroy_key ⇒ Object
123 124 125 |
# File 'lib/smooth_operator/persistence.rb', line 123 def destroy_key Helpers.get_instance_variable(self, :destroy_key, '_destroy') end |
#primary_key ⇒ Object
117 118 119 |
# File 'lib/smooth_operator/persistence.rb', line 117 def primary_key Helpers.get_instance_variable(self, :primary_key, 'id') end |
Instance Method Details
#create(attributes = nil, relative_path = nil, data = {}, options = {}) ⇒ Object
135 136 137 138 139 |
# File 'lib/smooth_operator/persistence.rb', line 135 def create(attributes = nil, relative_path = nil, data = {}, = {}) new(attributes).tap do |object| object.save(relative_path, data, ) end end |
#methods_vs_http_verbs ⇒ Object
113 114 115 |
# File 'lib/smooth_operator/persistence.rb', line 113 def methods_vs_http_verbs Helpers.get_instance_variable(self, :methods_vs_http_verbs, METHODS_VS_HTTP_VERBS.dup) end |