Commit 0fb9f5877a5aa0ee3d02ead97f5be2e5387931b2
1 parent
cffc52de
Exists in
master
and in
20 other branches
rails4.1: renamed reserved keyword
Showing
5 changed files
with
10 additions
and
9 deletions
Show diff stats
app/controllers/public/search_controller.rb
| @@ -62,7 +62,7 @@ class SearchController < PublicController | @@ -62,7 +62,7 @@ class SearchController < PublicController | ||
| 62 | end | 62 | end |
| 63 | 63 | ||
| 64 | def articles | 64 | def articles |
| 65 | - @scope = @environment.articles.public | 65 | + @scope = @environment.articles.is_public |
| 66 | full_text_search | 66 | full_text_search |
| 67 | end | 67 | end |
| 68 | 68 |
app/models/article.rb
| @@ -259,7 +259,8 @@ class Article < ActiveRecord::Base | @@ -259,7 +259,8 @@ class Article < ActiveRecord::Base | ||
| 259 | {:conditions => [ 'parent_id is null and profile_id = ?', profile.id ]} | 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 | :conditions => [ "advertise = ? AND published = ? AND profiles.visible = ? AND profiles.public_profile = ?", true, true, true, true ], :joins => [:profile] | 264 | :conditions => [ "advertise = ? AND published = ? AND profiles.visible = ? AND profiles.public_profile = ?", true, true, true, true ], :joins => [:profile] |
| 264 | 265 | ||
| 265 | scope :more_recent, | 266 | scope :more_recent, |
| @@ -280,7 +281,7 @@ class Article < ActiveRecord::Base | @@ -280,7 +281,7 @@ class Article < ActiveRecord::Base | ||
| 280 | 281 | ||
| 281 | def self.recent(limit = nil, extra_conditions = {}, pagination = true) | 282 | def self.recent(limit = nil, extra_conditions = {}, pagination = true) |
| 282 | result = scoped({:conditions => extra_conditions}). | 283 | result = scoped({:conditions => extra_conditions}). |
| 283 | - public. | 284 | + is_public. |
| 284 | relevant_as_recent. | 285 | relevant_as_recent. |
| 285 | limit(limit). | 286 | limit(limit). |
| 286 | order(['articles.published_at desc', 'articles.id desc']) | 287 | order(['articles.published_at desc', 'articles.id desc']) |
app/models/profile.rb
| @@ -133,7 +133,7 @@ class Profile < ActiveRecord::Base | @@ -133,7 +133,7 @@ class Profile < ActiveRecord::Base | ||
| 133 | 133 | ||
| 134 | scope :visible, :conditions => { :visible => true, :secret => false } | 134 | scope :visible, :conditions => { :visible => true, :secret => false } |
| 135 | scope :disabled, :conditions => { :visible => false } | 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 | scope :enabled, :conditions => { :enabled => true } | 137 | scope :enabled, :conditions => { :enabled => true } |
| 138 | 138 | ||
| 139 | # Subclasses must override this method | 139 | # Subclasses must override this method |
test/unit/article_test.rb
| @@ -1646,7 +1646,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1646,7 +1646,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1646 | art4 = create(Article, :name => 'article 4', :profile_id => fast_create(Person, :visible => false).id) | 1646 | art4 = create(Article, :name => 'article 4', :profile_id => fast_create(Person, :visible => false).id) |
| 1647 | art5 = create(Article, :name => 'article 5', :profile_id => fast_create(Person, :public_profile => false).id) | 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 | assert_includes articles, art1 | 1650 | assert_includes articles, art1 |
| 1651 | assert_not_includes articles, art2 | 1651 | assert_not_includes articles, art2 |
| 1652 | assert_not_includes articles, art3 | 1652 | assert_not_includes articles, art3 |
test/unit/profile_test.rb
| @@ -2074,10 +2074,10 @@ class ProfileTest < ActiveSupport::TestCase | @@ -2074,10 +2074,10 @@ class ProfileTest < ActiveSupport::TestCase | ||
| 2074 | p3 = fast_create(Profile, :public_profile => false) | 2074 | p3 = fast_create(Profile, :public_profile => false) |
| 2075 | p4 = fast_create(Profile, :visible => false, :public_profile => false) | 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 | end | 2081 | end |
| 2082 | 2082 | ||
| 2083 | should 'folder_types search for folders in the plugins' do | 2083 | should 'folder_types search for folders in the plugins' do |