lib/uploader/asset.rb in rails-uploader-0.4.0 vs lib/uploader/asset.rb in rails-uploader-0.4.1
- old
+ new
@@ -8,10 +8,16 @@
def fileupload_find_asset(params)
where(id: params[:id]).first
end
def fileupload_find_assets(params)
- where(fileupload_assetable_options(params))
+ conditions = fileupload_assetable_options(params)
+
+ if params[:assetable_id].blank? && !params[:guid].blank?
+ conditions[Uploader.guid_column] = params[:guid]
+ end
+
+ where(conditions)
end
def fileupload_assetable_options(params)
{
"#{Uploader.assetable_column}_type" => params[:assetable_type],