diff --git a/app/models/group.rb b/app/models/group.rb index c96248ebd29..011cc297ba9 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -49,7 +49,8 @@ class Group < ActiveRecord::Base extra_users = group.users.where("users.id NOT IN (#{real_ids})").select('users.id') - missing_users = GroupUser.joins("RIGHT JOIN (#{real_ids}) X ON X.id = user_id AND group_id = #{group.id}") + missing_users = GroupUser + .joins("RIGHT JOIN (#{real_ids}) X ON X.id = user_id AND group_id = #{group.id}") .where("user_id IS NULL") .select("X.id") @@ -77,15 +78,12 @@ class Group < ActiveRecord::Base end def self.[](name) - unless g = lookup_group(name) - g = refresh_automatic_group!(name) - end - g + lookup_group(name) || refresh_automatic_group!(name) end def self.lookup_group(name) raise ArgumentError, "unknown group" unless id = AUTO_GROUPS[name] - g = Group.where(id: id).first + Group.where(id: id).first end diff --git a/lib/freedom_patches/performance_fixes.rb b/lib/freedom_patches/performance_fixes.rb index 74d0e2e06c5..30827702a67 100644 --- a/lib/freedom_patches/performance_fixes.rb +++ b/lib/freedom_patches/performance_fixes.rb @@ -14,6 +14,7 @@ class ActionView::Helpers::AssetTagHelper::AssetIncludeTag private # pluralization is fairly expensive, and pluralizing the word javascript 400 times is pointless + # this is fixed in Rails 4 def path_to_asset(source, options = {}) asset_paths.compute_public_path(source, pluralize_asset_name(asset_name), options.merge(:ext => extension))