Module: Sunrise::FileUpload::ActiveRecord::ClassMethods

Defined in:
lib/sunrise/file_upload/active_record.rb

Instance Method Summary collapse

Instance Method Details

#fileupload_find(method, guid) ⇒ Object

Find asset by guid



40
41
42
43
# File 'lib/sunrise/file_upload/active_record.rb', line 40

def fileupload_find(method, guid)
  klass = fileupload_klass(method)
  klass.where(:guid => guid).first
end

#fileupload_update(record_id, guid, method) ⇒ Object

Update reflection klass by guid



34
35
36
37
# File 'lib/sunrise/file_upload/active_record.rb', line 34

def fileupload_update(record_id, guid, method)
  klass = fileupload_klass(method)
  klass.update_all(["assetable_id = ?, guid = ?", record_id, nil], ["assetable_type = ? AND guid = ?", name, guid])
end