Created
May 1, 2012 14:39
-
-
Save Centaur/2568390 to your computer and use it in GitHub Desktop.
memory leak
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 characters
class TalentsController < ApplicationController | |
PUBLICS = %w(screen presenter musical t_stage others) | |
layout :different_layout | |
# memory leak | |
def different_layout | |
if PUBLICS.tap { |a| a.concat(a.map { |s| s+'_preview' }) }.include?(action_name) | |
'talents' | |
else | |
'admin' | |
end | |
end | |
# no memory leak | |
def different_layout | |
previewed = PUBLICS.map{|s| s+'_preview'} | |
#if PUBLICS.tap { |a| a.concat(a.map { |s| s+'_preview' }) }.include?(action_name) | |
if previewed.include?(action_name) or PUBLICS.include?(action_name) | |
'talents' | |
else | |
'admin' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment