diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index 2429106..1001baa 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -62,7 +62,7 @@ class SearchController < PublicController end def articles - @scope = @environment.articles.public + @scope = @environment.articles.is_public full_text_search end diff --git a/app/models/article.rb b/app/models/article.rb index bdb304d..6600e89 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -259,7 +259,8 @@ class Article < ActiveRecord::Base {:conditions => [ 'parent_id is null and profile_id = ?', profile.id ]} } - scope :public, + # :public is reserved on rails 4.1, use is_public instead + scope :is_public, :conditions => [ "advertise = ? AND published = ? AND profiles.visible = ? AND profiles.public_profile = ?", true, true, true, true ], :joins => [:profile] scope :more_recent, @@ -280,7 +281,7 @@ class Article < ActiveRecord::Base def self.recent(limit = nil, extra_conditions = {}, pagination = true) result = scoped({:conditions => extra_conditions}). - public. + is_public. relevant_as_recent. limit(limit). order(['articles.published_at desc', 'articles.id desc']) diff --git a/app/models/profile.rb b/app/models/profile.rb index 81eb3bf..12a83c4 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -133,7 +133,7 @@ class Profile < ActiveRecord::Base scope :visible, :conditions => { :visible => true, :secret => false } scope :disabled, :conditions => { :visible => false } - scope :public, :conditions => { :visible => true, :public_profile => true, :secret => false } + scope :is_public, :conditions => { :visible => true, :public_profile => true, :secret => false } scope :enabled, :conditions => { :enabled => true } # Subclasses must override this method diff --git a/test/unit/article_test.rb b/test/unit/article_test.rb index 68ae33f..6c1e510 100644 --- a/test/unit/article_test.rb +++ b/test/unit/article_test.rb @@ -1646,7 +1646,7 @@ class ArticleTest < ActiveSupport::TestCase art4 = create(Article, :name => 'article 4', :profile_id => fast_create(Person, :visible => false).id) art5 = create(Article, :name => 'article 5', :profile_id => fast_create(Person, :public_profile => false).id) - articles = Article.public + articles = Article.is_public assert_includes articles, art1 assert_not_includes articles, art2 assert_not_includes articles, art3 diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 7bf13da..2bec4b6 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -2074,10 +2074,10 @@ class ProfileTest < ActiveSupport::TestCase p3 = fast_create(Profile, :public_profile => false) p4 = fast_create(Profile, :visible => false, :public_profile => false) - assert_includes Profile.public, p1 - assert_not_includes Profile.public, p2 - assert_not_includes Profile.public, p3 - assert_not_includes Profile.public, p4 + assert_includes Profile.is_public, p1 + assert_not_includes Profile.is_public, p2 + assert_not_includes Profile.is_public, p3 + assert_not_includes Profile.is_public, p4 end should 'folder_types search for folders in the plugins' do -- libgit2 0.21.2