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 | 265 | |
| 266 | 266 | def search |
| 267 | 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 | 269 | render :text => article_list_to_json(results), :content_type => 'application/json' |
| 270 | 270 | end |
| 271 | 271 | def media_upload | ... | ... |
app/models/profile.rb
| ... | ... | @@ -164,6 +164,8 @@ class Profile < ActiveRecord::Base |
| 164 | 164 | has_many :articles, :dependent => :destroy |
| 165 | 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 | 169 | acts_as_having_image |
| 168 | 170 | |
| 169 | 171 | has_many :tasks, :dependent => :destroy, :as => 'target' | ... | ... |