Module: NCore::Delete::ClassMethods
- Defined in:
- lib/ncore/methods/delete.rb
Instance Method Summary collapse
-
#delete(id, params = {}) ⇒ Object
always returns a new object; check .errors? or .valid? to see how it went.
- #delete!(id, params = {}) ⇒ Object
Instance Method Details
#delete(id, params = {}) ⇒ Object
always returns a new object; check .errors? or .valid? to see how it went
15 16 17 18 19 20 |
# File 'lib/ncore/methods/delete.rb', line 15 def delete(id, params={}) raise(module_parent::RecordNotFound, "Cannot delete id=nil") if id.blank? obj = new({id: id}) obj.delete(params) obj end |
#delete!(id, params = {}) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/ncore/methods/delete.rb', line 6 def delete!(id, params={}) obj = delete(id, params) if obj.errors? raise module_parent::RecordInvalid, obj end obj end |