|
@@ -142,7 +142,7 @@ returns
|
|
|
attributes = self.attributes
|
|
|
self.class.reflect_on_all_associations.map { |assoc|
|
|
|
real_key = assoc.name.to_s[0, assoc.name.to_s.length - 1] + '_ids'
|
|
|
- if self.respond_to?(real_key)
|
|
|
+ if respond_to?(real_key)
|
|
|
attributes[ real_key ] = send(real_key)
|
|
|
end
|
|
|
}
|
|
@@ -230,7 +230,7 @@ returns
|
|
|
end
|
|
|
|
|
|
def cache_update(o)
|
|
|
- cache_delete if self.respond_to?('cache_delete')
|
|
|
+ cache_delete if respond_to?('cache_delete')
|
|
|
o.cache_delete if o.respond_to?('cache_delete')
|
|
|
end
|
|
|
|
|
@@ -241,7 +241,7 @@ returns
|
|
|
Cache.delete(key)
|
|
|
|
|
|
# delete old name / login caches
|
|
|
- if self.changed?
|
|
|
+ if changed?
|
|
|
if changes.key?('name')
|
|
|
name = changes['name'][0]
|
|
|
key = "#{self.class}::#{name}"
|
|
@@ -349,9 +349,9 @@ returns
|
|
|
end
|
|
|
}
|
|
|
return
|
|
|
- else
|
|
|
- fail 'Need name, id or login for lookup()'
|
|
|
end
|
|
|
+
|
|
|
+ fail 'Need name, id or login for lookup()'
|
|
|
end
|
|
|
|
|
|
=begin
|
|
@@ -442,7 +442,7 @@ returns
|
|
|
# do lookup with == to handle case insensitive databases
|
|
|
records = where(login: data[:login])
|
|
|
records.each {|loop_record|
|
|
|
- if loop_record.login.downcase == data[:login].downcase
|
|
|
+ if loop_record.login.casecmp data[:login] == 0
|
|
|
loop_record.update_attributes(data)
|
|
|
return loop_record
|
|
|
end
|
|
@@ -455,7 +455,7 @@ returns
|
|
|
# do lookup with == to handle case insensitive databases
|
|
|
records = where(email: data[:email])
|
|
|
records.each {|loop_record|
|
|
|
- if loop_record.email.downcase == data[:email].downcase
|
|
|
+ if loop_record.email.casecmp data[:email] == 0
|
|
|
loop_record.update_attributes(data)
|
|
|
return loop_record
|
|
|
end
|
|
@@ -468,7 +468,7 @@ returns
|
|
|
# do lookup with == to handle case insensitive databases
|
|
|
records = where(locale: data[:locale])
|
|
|
records.each {|loop_record|
|
|
|
- if loop_record.locale.downcase == data[:locale].downcase
|
|
|
+ if loop_record.locale.casecmp data[:locale] == 0
|
|
|
loop_record.update_attributes(data)
|
|
|
return loop_record
|
|
|
end
|
|
@@ -783,7 +783,7 @@ log object update activity stream, if configured - will be executed automaticall
|
|
|
def activity_stream_update
|
|
|
return if !self.class.activity_stream_support_config
|
|
|
|
|
|
- return if !self.changed?
|
|
|
+ return if !changed?
|
|
|
|
|
|
# default ignored attributes
|
|
|
ignore_attributes = {
|
|
@@ -872,10 +872,10 @@ log object update history with all updated attributes, if configured - will be e
|
|
|
def history_update
|
|
|
return if !self.class.history_support_config
|
|
|
|
|
|
- return if !self.changed?
|
|
|
+ return if !changed?
|
|
|
|
|
|
# return if it's no update
|
|
|
- return if self.new_record?
|
|
|
+ return if new_record?
|
|
|
|
|
|
# new record also triggers update, so ignore new records
|
|
|
changes = self.changes
|
|
@@ -921,7 +921,7 @@ log object update history with all updated attributes, if configured - will be e
|
|
|
value_id[0] = value[0]
|
|
|
value_id[1] = value[1]
|
|
|
|
|
|
- if self.respond_to?( attribute_name ) && send(attribute_name)
|
|
|
+ if respond_to?( attribute_name ) && send(attribute_name)
|
|
|
relation_class = send(attribute_name).class
|
|
|
if relation_class && value_id[0]
|
|
|
relation_model = relation_class.lookup( id: value_id[0] )
|