mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
reduce funcalls by using falsey objects
This commit is contained in:
@@ -12,7 +12,7 @@ module ActiveRecord
|
||||
|
||||
def replace(record)
|
||||
record = record.target if AssociationProxy === record
|
||||
raise_on_type_mismatch(record) unless record.nil?
|
||||
raise_on_type_mismatch(record) if record
|
||||
|
||||
update_counters(record)
|
||||
replace_keys(record)
|
||||
@@ -59,7 +59,7 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
def foreign_key_present?
|
||||
!@owner[@reflection.foreign_key].nil?
|
||||
@owner[@reflection.foreign_key]
|
||||
end
|
||||
|
||||
# NOTE - for now, we're only supporting inverse setting from belongs_to back onto
|
||||
|
||||
Reference in New Issue
Block a user