Method: DataActive::Entity#find_existing

Defined in:
lib/data_active/entity.rb

#find_existingObject



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/data_active/entity.rb', line 107

def find_existing
  existing_record = nil

  begin
    existing_record = @klass.find(@attributes[@klass.primary_key.to_s].content) if @attributes[@klass.primary_key.to_s].present?
  rescue
    existing_record = nil
  end

  existing_record
end