lib/forge/app/models/asset.rb in forge-cli-0.1.4 vs lib/forge/app/models/asset.rb in forge-cli-0.1.5
- old
+ new
@@ -29,10 +29,10 @@
Paperclip::Geometry.from_file(file).to_s.split('x')
end
def self.for_drawer(params)
unless params[:q].blank?
- assets = where("assets.title LIKE ? OR tags.name = ?", "%#{params[:q]}%", params[:q]).includes(:taggings => :tag)
+ assets = where("LOWER(assets.title) LIKE ? OR LOWER(tags.name) = ?", "%#{params[:q].downcase}%", params[:q].downcase).includes(:tags).references(:tags)
else
case params[:filter]
when "images"
assets = where("attachment_content_type LIKE ?", "%image%")
when "documents"