Module: Her::Model::ORM::DestroyMethods
- Extended by:
- ActiveSupport::Concern
- Included in:
- Her::Model::ORM
- Defined in:
- lib/her/model/orm/destroy_methods.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #delete ⇒ Object
-
#destroy ⇒ Object
Destroy a resource.
Instance Method Details
#delete ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/her/model/orm/destroy_methods.rb', line 25 def delete resource = self self.class.wrap_in_hooks(resource, :destroy) do |resource, klass| klass.request({_method: :delete, _path: build_request_path(params.merge(soft: true))}) do |parsed_data| self.data = self.class.parse(parsed_data[:data]) self. = parsed_data[:metadata] self.errors = parsed_data[:errors] end end self end |
#destroy ⇒ Object
Destroy a resource
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/her/model/orm/destroy_methods.rb', line 13 def destroy resource = self self.class.wrap_in_hooks(resource, :destroy) do |resource, klass| klass.request(_method: :delete, _path: request_path) do |parsed_data| self.data = self.class.parse(parsed_data[:data]) self. = parsed_data[:metadata] self.errors = parsed_data[:errors] end end self end |