Module: SugarCRM::AttributeMethods

Defined in:
lib/sugarcrm/attributes/attribute_methods.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#attributes_changed?Boolean

Returns:

  • (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

Returns:

  • (Boolean)


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

Returns:

  • (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?

Returns:

  • (Boolean)


76
77
78
# File 'lib/sugarcrm/attributes/attribute_methods.rb', line 76

def new?
  @attributes[:id].blank?
end

#required_attributesObject 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_modelObject



87
88
89
# File 'lib/sugarcrm/attributes/attribute_methods.rb', line 87

def to_model
  self
end