Revert "query the slave for settings and Account#account_users_for"

This reverts commit acee113da4

Change-Id: Ib14805c2c024c908397bb16c52e2a2967be713ca
Reviewed-on: https://gerrit.instructure.com/13234
Tested-by: Jenkins <jenkins@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Brian Palmer 2012-08-26 20:10:07 -06:00
parent acee113da4
commit ca999b70c0
2 changed files with 4 additions and 8 deletions

View File

@ -545,11 +545,9 @@ class Account < ActiveRecord::Base
def account_users_for(user)
@account_chain_ids ||= self.account_chain(:include_site_admin => true).map { |a| a.active? ? a.id : nil }.compact
@account_users_cache ||= {}
ActiveRecord::Base::ConnectionSpecification.with_environment(:slave) do
@account_users_cache[user] ||= Shard.partition_by_shard(@account_chain_ids) do |account_chain_ids|
AccountUser.find(:all, :conditions => { :account_id => account_chain_ids, :user_id => user.id })
end if user
end
@account_users_cache[user] ||= Shard.partition_by_shard(@account_chain_ids) do |account_chain_ids|
AccountUser.find(:all, :conditions => { :account_id => account_chain_ids, :user_id => user.id })
end if user
@account_users_cache[user] ||= []
@account_users_cache[user]
end

View File

@ -22,9 +22,7 @@ class Setting < ActiveRecord::Base
@@cache = {}
def self.get(name, default)
ActiveRecord::Base::ConnectionSpecification.with_environment(:slave) do
Setting.find_or_initialize_by_name(name, :value => default).value
end
Setting.find_or_initialize_by_name(name, :value => default).value
end
def self.set(name, value)