Commit 0fb9f5877a5aa0ee3d02ead97f5be2e5387931b2

Authored by Braulio Bhavamitra
1 parent cffc52de

rails4.1: renamed reserved keyword

app/controllers/public/search_controller.rb
... ... @@ -62,7 +62,7 @@ class SearchController < PublicController
62 62 end
63 63  
64 64 def articles
65   - @scope = @environment.articles.public
  65 + @scope = @environment.articles.is_public
66 66 full_text_search
67 67 end
68 68  
... ...
app/models/article.rb
... ... @@ -259,7 +259,8 @@ class Article < ActiveRecord::Base
259 259 {:conditions => [ 'parent_id is null and profile_id = ?', profile.id ]}
260 260 }
261 261  
262   - scope :public,
  262 + # :public is reserved on rails 4.1, use is_public instead
  263 + scope :is_public,
263 264 :conditions => [ "advertise = ? AND published = ? AND profiles.visible = ? AND profiles.public_profile = ?", true, true, true, true ], :joins => [:profile]
264 265  
265 266 scope :more_recent,
... ... @@ -280,7 +281,7 @@ class Article < ActiveRecord::Base
280 281  
281 282 def self.recent(limit = nil, extra_conditions = {}, pagination = true)
282 283 result = scoped({:conditions => extra_conditions}).
283   - public.
  284 + is_public.
284 285 relevant_as_recent.
285 286 limit(limit).
286 287 order(['articles.published_at desc', 'articles.id desc'])
... ...
app/models/profile.rb
... ... @@ -133,7 +133,7 @@ class Profile < ActiveRecord::Base
133 133  
134 134 scope :visible, :conditions => { :visible => true, :secret => false }
135 135 scope :disabled, :conditions => { :visible => false }
136   - scope :public, :conditions => { :visible => true, :public_profile => true, :secret => false }
  136 + scope :is_public, :conditions => { :visible => true, :public_profile => true, :secret => false }
137 137 scope :enabled, :conditions => { :enabled => true }
138 138  
139 139 # Subclasses must override this method
... ...
test/unit/article_test.rb
... ... @@ -1646,7 +1646,7 @@ class ArticleTest < ActiveSupport::TestCase
1646 1646 art4 = create(Article, :name => 'article 4', :profile_id => fast_create(Person, :visible => false).id)
1647 1647 art5 = create(Article, :name => 'article 5', :profile_id => fast_create(Person, :public_profile => false).id)
1648 1648  
1649   - articles = Article.public
  1649 + articles = Article.is_public
1650 1650 assert_includes articles, art1
1651 1651 assert_not_includes articles, art2
1652 1652 assert_not_includes articles, art3
... ...
test/unit/profile_test.rb
... ... @@ -2074,10 +2074,10 @@ class ProfileTest < ActiveSupport::TestCase
2074 2074 p3 = fast_create(Profile, :public_profile => false)
2075 2075 p4 = fast_create(Profile, :visible => false, :public_profile => false)
2076 2076  
2077   - assert_includes Profile.public, p1
2078   - assert_not_includes Profile.public, p2
2079   - assert_not_includes Profile.public, p3
2080   - assert_not_includes Profile.public, p4
  2077 + assert_includes Profile.is_public, p1
  2078 + assert_not_includes Profile.is_public, p2
  2079 + assert_not_includes Profile.is_public, p3
  2080 + assert_not_includes Profile.is_public, p4
2081 2081 end
2082 2082  
2083 2083 should 'folder_types search for folders in the plugins' do
... ...