Commit e9d95cb78ff0926eccbcba2862150909319b5da3
1 parent
095531ac
Exists in
master
and in
28 other branches
Restrict media search to files
Showing
2 changed files
with
3 additions
and
1 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -265,7 +265,7 @@ class CmsController < MyProfileController | @@ -265,7 +265,7 @@ class CmsController < MyProfileController | ||
265 | 265 | ||
266 | def search | 266 | def search |
267 | query = params[:q] | 267 | query = params[:q] |
268 | - results = query.blank? ? [] : profile.articles.published.find_by_contents(query) | 268 | + results = query.blank? ? [] : profile.files.published.find_by_contents(query) |
269 | render :text => article_list_to_json(results), :content_type => 'application/json' | 269 | render :text => article_list_to_json(results), :content_type => 'application/json' |
270 | end | 270 | end |
271 | def media_upload | 271 | def media_upload |
app/models/profile.rb
@@ -164,6 +164,8 @@ class Profile < ActiveRecord::Base | @@ -164,6 +164,8 @@ class Profile < ActiveRecord::Base | ||
164 | has_many :articles, :dependent => :destroy | 164 | has_many :articles, :dependent => :destroy |
165 | belongs_to :home_page, :class_name => Article.name, :foreign_key => 'home_page_id' | 165 | belongs_to :home_page, :class_name => Article.name, :foreign_key => 'home_page_id' |
166 | 166 | ||
167 | + has_many :files, :class_name => 'UploadedFile' | ||
168 | + | ||
167 | acts_as_having_image | 169 | acts_as_having_image |
168 | 170 | ||
169 | has_many :tasks, :dependent => :destroy, :as => 'target' | 171 | has_many :tasks, :dependent => :destroy, :as => 'target' |