Last active
February 10, 2016 19:54
-
-
Save simonista/ae3dec376a3272c0782b to your computer and use it in GitHub Desktop.
Revisions
-
simonista revised this gist
Feb 10, 2016 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ # Current gotcha's: # - any result to be cached in the ivar (currently not true for the early return) # - if any of the early return stuff, or if the session.key is created, we don't want to run brand_config_for_account(opts) def active_brand_config(opts={}) @active_brand_config_cache ||= {} -
simonista revised this gist
Feb 10, 2016 . 1 changed file with 18 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,19 @@ def active_brand_config(opts={}) @active_brand_config_cache ||= {} return @active_brand_config_cache[opts] if @active_brand_config_cache.key?(opts) @active_brand_config_cache[opts] = begin return nil if !use_new_styles? || (@current_user.try(:prefers_high_contrast?) && !opts[:ignore_high_contrast_preference]) brand_config = if session.key?(:brand_config_md5) BrandConfig.where(md5: session[:brand_config_md5]).first else brand_config_for_account(opts) end if !brand_config && k12? brand_config = BrandConfig.k12_config end brand_config end end -
simonista created this gist
Feb 10, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ def active_brand_config(opts={}) @active_brand_config_cache ||= {} return @active_brand_config_cache[opts] if @active_brand_config_cache.key?(opts) @active_brand_config_cache[opts] = begin return nil if !use_new_styles? || (@current_user.try(:prefers_high_contrast?) && !opts[:ignore_high_contrast_preference]) brand_config = if session.key?(:brand_config_md5) BrandConfig.where(md5: session[:brand_config_md5]).first else brand_config_for_account(opts) end if !brand_config && k12? brand_config = BrandConfig.k12_config end brand_config end end