Module: SmoothOperator::Persistence::ClassMethods
- Defined in:
- lib/smooth_operator/persistence.rb
Instance Method Summary collapse
- #create(attributes = nil, relative_path = nil, data = {}, options = {}) ⇒ Object
- #methods_http_verbs ⇒ Object
Instance Method Details
#create(attributes = nil, relative_path = nil, data = {}, options = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/smooth_operator/persistence.rb', line 19 def create(attributes = nil, relative_path = nil, data = {}, = {}) if attributes.is_a?(Array) attributes.map { |array_entry| create(array_entry, relative_path, data, ) } else new(attributes).tap { |object| object.save(relative_path, data, ) } end end |
#methods_http_verbs ⇒ Object
11 12 13 |
# File 'lib/smooth_operator/persistence.rb', line 11 def methods_http_verbs @methods_http_verbs ||= { create: :post, save: :put, destroy: :delete } end |