4
5
6
7
8
9
10
11
|
# File 'app/services/goldencobra/attribute_repair_service.rb', line 4
def self.fix_duplicate_http(model_name, id, attribute_name)
return "Not a valid model name" unless is_class?(model_name)
return "Not a valid attribute on #{model_name}" unless is_attribute?(model_name, attribute_name)
return "Record not found" unless record_exists?(model_name, id)
record = "#{model_name}".constantize.where(id: id).first
record.update_attribute(attribute_name.to_sym, repaired_url_value(record.send(attribute_name.to_sym)))
end
|