Commit da3e25aae0205f8e683fb3e35320e1be6cbf8049

Authored by Victor Costa
1 parent d9a3fdb3

Revert "Merge branch 'fix_lazy_queries' into stable"

This reverts commit 853cc8ef357b5eeb2d25cf586fb96bbeab36a785, reversing
changes made to a0ef4f259127426b96f8a8ba2bbb2c18c67bf980.

This reverts commit b8304468ef6de86accdfd442c889f30b2fdd9539, reversing
changes made to ed4938b5272fb57a714c84c3443c7d329c9407aa.

This reverts commit 77ee15d0896424d4c02de0a61ad8922e5b38304c, reversing
changes made to b52c66dba90218f9dd21b10dee85e293ccf52aa7.

This reverts commit a0ef4f259127426b96f8a8ba2bbb2c18c67bf980, reversing
changes made to 5c4d0723fb8977e29f0e208e6d3c609933281cec.
@@ -24,10 +24,6 @@ gem 'locale', '~> 2.0.5' @@ -24,10 +24,6 @@ gem 'locale', '~> 2.0.5'
24 # FIXME list here all actual dependencies (i.e. the ones in debian/control), 24 # FIXME list here all actual dependencies (i.e. the ones in debian/control),
25 # with their GEM names (not the Debian package names) 25 # with their GEM names (not the Debian package names)
26 26
27 -group :development do  
28 - gem 'bullet'  
29 -end  
30 -  
31 group :production do 27 group :production do
32 gem 'dalli', '~> 2.7.0' 28 gem 'dalli', '~> 2.7.0'
33 end 29 end
app/controllers/my_profile/cms_controller.rb
@@ -59,7 +59,7 @@ class CmsController < MyProfileController @@ -59,7 +59,7 @@ class CmsController < MyProfileController
59 conditions = ['type != ?', 'RssFeed'] 59 conditions = ['type != ?', 'RssFeed']
60 end 60 end
61 61
62 - @articles = @article.children.includes(:parent).reorder("case when type = 'Folder' then 0 when type ='Blog' then 1 else 2 end, updated_at DESC, name").paginate( 62 + @articles = @article.children.reorder("case when type = 'Folder' then 0 when type ='Blog' then 1 else 2 end, updated_at DESC, name").paginate(
63 :conditions => conditions, 63 :conditions => conditions,
64 :per_page => per_page, 64 :per_page => per_page,
65 :page => params[:npage] 65 :page => params[:npage]
app/controllers/public/content_viewer_controller.rb
@@ -221,7 +221,7 @@ class ContentViewerController < ApplicationController @@ -221,7 +221,7 @@ class ContentViewerController < ApplicationController
221 # relation. 221 # relation.
222 posts = posts.native_translations if blog_with_translation?(@page) 222 posts = posts.native_translations if blog_with_translation?(@page)
223 223
224 - @posts = posts.paginate({ :page => params[:npage], :per_page => @page.posts_per_page }.merge(Article.display_filter(user, profile))).includes(:author).to_a 224 + @posts = posts.paginate({ :page => params[:npage], :per_page => @page.posts_per_page }.merge(Article.display_filter(user, profile))).to_a
225 225
226 if blog_with_translation?(@page) 226 if blog_with_translation?(@page)
227 @posts.replace @posts.map{ |p| p.get_translation_to(FastGettext.locale) }.compact 227 @posts.replace @posts.map{ |p| p.get_translation_to(FastGettext.locale) }.compact
app/models/article.rb
@@ -258,7 +258,7 @@ class Article < ActiveRecord::Base @@ -258,7 +258,7 @@ class Article < ActiveRecord::Base
258 # retrieves all articles belonging to the given +profile+ that are not 258 # retrieves all articles belonging to the given +profile+ that are not
259 # sub-articles of any other article. 259 # sub-articles of any other article.
260 scope :top_level_for, lambda { |profile| 260 scope :top_level_for, lambda { |profile|
261 - {:conditions => [ 'parent_id is null and profile_id = ?', profile.id ], :include => [:profile]} 261 + {:conditions => [ 'parent_id is null and profile_id = ?', profile.id ]}
262 } 262 }
263 263
264 scope :public, 264 scope :public,
app/models/category.rb
@@ -16,7 +16,7 @@ class Category < ActiveRecord::Base @@ -16,7 +16,7 @@ class Category < ActiveRecord::Base
16 16
17 # Finds all top level categories for a given environment. 17 # Finds all top level categories for a given environment.
18 scope :top_level_for, lambda { |environment| 18 scope :top_level_for, lambda { |environment|
19 - {:conditions => ['parent_id is null and environment_id = ?', environment.id ], :include => [:children]} 19 + {:conditions => ['parent_id is null and environment_id = ?', environment.id ]}
20 } 20 }
21 21
22 scope :on_level, lambda { |parent| {:conditions => {:parent_id => parent}} } 22 scope :on_level, lambda { |parent| {:conditions => {:parent_id => parent}} }
app/models/comment.rb
@@ -18,7 +18,7 @@ class Comment < ActiveRecord::Base @@ -18,7 +18,7 @@ class Comment < ActiveRecord::Base
18 has_many :children, :class_name => 'Comment', :foreign_key => 'reply_of_id', :dependent => :destroy 18 has_many :children, :class_name => 'Comment', :foreign_key => 'reply_of_id', :dependent => :destroy
19 belongs_to :reply_of, :class_name => 'Comment', :foreign_key => 'reply_of_id' 19 belongs_to :reply_of, :class_name => 'Comment', :foreign_key => 'reply_of_id'
20 20
21 - scope :without_reply, :conditions => ['comments.reply_of_id IS NULL'] 21 + scope :without_reply, :conditions => ['reply_of_id IS NULL']
22 22
23 #FIXME make this test 23 #FIXME make this test
24 scope :newer_than, lambda { |reference_id| 24 scope :newer_than, lambda { |reference_id|
app/models/person.rb
@@ -444,7 +444,7 @@ roles] } @@ -444,7 +444,7 @@ roles] }
444 end 444 end
445 445
446 def already_reported?(profile) 446 def already_reported?(profile)
447 - abuse_reports.includes({:abuse_complaint => :reported}).any? { |report| report.abuse_complaint.reported == profile && report.abuse_complaint.opened? } 447 + abuse_reports.any? { |report| report.abuse_complaint.reported == profile && report.abuse_complaint.opened? }
448 end 448 end
449 449
450 def register_report(abuse_report, profile) 450 def register_report(abuse_report, profile)
app/models/profile.rb
@@ -229,7 +229,7 @@ class Profile < ActiveRecord::Base @@ -229,7 +229,7 @@ class Profile < ActiveRecord::Base
229 belongs_to :preferred_domain, :class_name => 'Domain', :foreign_key => 'preferred_domain_id' 229 belongs_to :preferred_domain, :class_name => 'Domain', :foreign_key => 'preferred_domain_id'
230 belongs_to :environment 230 belongs_to :environment
231 231
232 - has_many :articles, :dependent => :destroy, :include => [:profile] 232 + has_many :articles, :dependent => :destroy
233 belongs_to :home_page, :class_name => Article.name, :foreign_key => 'home_page_id' 233 belongs_to :home_page, :class_name => Article.name, :foreign_key => 'home_page_id'
234 234
235 has_many :files, :class_name => 'UploadedFile' 235 has_many :files, :class_name => 'UploadedFile'
app/views/comment/_comment.html.erb
@@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
64 64
65 <% unless comment.replies.blank? || comment.spam? %> 65 <% unless comment.replies.blank? || comment.spam? %>
66 <ul class="comment-replies"> 66 <ul class="comment-replies">
67 - <% comment.replies.includes([:children, :author]).each do |reply| %> 67 + <% comment.replies.each do |reply| %>
68 <%= render :partial => 'comment/comment', :locals => { :comment => reply } %> 68 <%= render :partial => 'comment/comment', :locals => { :comment => reply } %>
69 <% end %> 69 <% end %>
70 </ul> 70 </ul>
config/environments/development.rb
@@ -35,10 +35,4 @@ Noosfero::Application.configure do @@ -35,10 +35,4 @@ Noosfero::Application.configure do
35 config.assets.debug = true 35 config.assets.debug = true
36 36
37 config.consider_all_requests_local = true 37 config.consider_all_requests_local = true
38 -  
39 - config.after_initialize do  
40 - Bullet.enable = true  
41 - Bullet.console = true  
42 - end  
43 -  
44 end 38 end
lib/acts_as_having_posts.rb
@@ -2,7 +2,7 @@ module ActsAsHavingPosts @@ -2,7 +2,7 @@ module ActsAsHavingPosts
2 2
3 module ClassMethods 3 module ClassMethods
4 def acts_as_having_posts(options = {}) 4 def acts_as_having_posts(options = {})
5 - has_many :posts, { :class_name => 'Article', :foreign_key => 'parent_id', :source => :children, :conditions => [ 'articles.type != ?', 'RssFeed' ], :order => 'published_at DESC, id DESC', :include => [:parent, :profile] }.merge(options) 5 + has_many :posts, { :class_name => 'Article', :foreign_key => 'parent_id', :source => :children, :conditions => [ 'articles.type != ?', 'RssFeed' ], :order => 'published_at DESC, id DESC' }.merge(options)
6 6
7 attr_accessor :feed_attrs 7 attr_accessor :feed_attrs
8 8
lib/spammable.rb
@@ -12,8 +12,8 @@ module Spammable @@ -12,8 +12,8 @@ module Spammable
12 def self.extended (base) 12 def self.extended (base)
13 if base.respond_to?(:scope) 13 if base.respond_to?(:scope)
14 base.class_eval do 14 base.class_eval do
15 - scope :without_spam, :conditions => ["#{base.table_name}.spam IS NULL OR #{base.table_name}.spam = ?", false]  
16 - scope :spam, :conditions => ["#{base.table_name}.spam = ?", true] 15 + scope :without_spam, :conditions => ['spam IS NULL OR spam = ?', false]
  16 + scope :spam, :conditions => ['spam = ?', true]
17 end 17 end
18 end 18 end
19 end 19 end
test/functional/manage_products_controller_test.rb
@@ -150,7 +150,7 @@ class ManageProductsControllerTest &lt; ActionController::TestCase @@ -150,7 +150,7 @@ class ManageProductsControllerTest &lt; ActionController::TestCase
150 category2 = fast_create(ProductCategory, :name => 'Category 2', :parent_id => category1.id) 150 category2 = fast_create(ProductCategory, :name => 'Category 2', :parent_id => category1.id)
151 category3 = fast_create(ProductCategory, :name => 'Category 3', :parent_id => category2.id) 151 category3 = fast_create(ProductCategory, :name => 'Category 3', :parent_id => category2.id)
152 get :new, :profile => @enterprise.identifier 152 get :new, :profile => @enterprise.identifier
153 - assert_tag :tag => 'select', :attributes => { :id => 'category_id' }, :descendant => { :tag => 'option', :content => category1.name + " &raquo;" } 153 + assert_tag :tag => 'select', :attributes => { :id => 'category_id' }, :descendant => { :tag => 'option', :content => category1.name }
154 end 154 end
155 155
156 should "create new product categorized" do 156 should "create new product categorized" do