refactor
This commit is contained in:
parent
a80ec535a3
commit
8f46653345
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue