Module: SugarCRM::AttributeMethods
- Defined in:
- lib/sugarcrm/attributes/attribute_methods.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #attributes_changed? ⇒ Boolean
-
#changed? ⇒ Boolean
Determines if attributes or associations have been changed.
- #destroyed? ⇒ Boolean
-
#new? ⇒ Boolean
(also: #new_record?)
Is this a new record?.
-
#required_attributes ⇒ Object
(also: #required_fields)
List the required attributes for save.
- #to_model ⇒ Object
Instance Method Details
#attributes_changed? ⇒ Boolean
71 72 73 |
# File 'lib/sugarcrm/attributes/attribute_methods.rb', line 71 def attributes_changed? @modified_attributes.length > 0 end |
#changed? ⇒ Boolean
Determines if attributes or associations have been changed
61 62 63 64 65 |
# File 'lib/sugarcrm/attributes/attribute_methods.rb', line 61 def changed? return true if attributes_changed? return true if associations_changed? false end |
#destroyed? ⇒ Boolean
67 68 69 |
# File 'lib/sugarcrm/attributes/attribute_methods.rb', line 67 def destroyed? @attributes[:deleted] end |
#new? ⇒ Boolean Also known as: new_record?
Is this a new record?
76 77 78 |
# File 'lib/sugarcrm/attributes/attribute_methods.rb', line 76 def new? @attributes[:id].blank? end |
#required_attributes ⇒ Object Also known as: required_fields
List the required attributes for save
82 83 84 |
# File 'lib/sugarcrm/attributes/attribute_methods.rb', line 82 def required_attributes self.class._module.required_fields end |
#to_model ⇒ Object
87 88 89 |
# File 'lib/sugarcrm/attributes/attribute_methods.rb', line 87 def to_model self end |