Rob Sanheim
2006-Jul-11 15:42 UTC
[Rails] better way to include helpers into application controller/test_helper?
Right now, I have the following in my application controller - and a
simliar version is duplicated in test_helper. There must be a better
way to include common functionality like this that gets used across
layers? Maybe at the very least a way to include it at the class
level and instance level with one line?
# provide access to text helper at class level
def self.text_helper
Helper.instance
end
# instance level
def text_helper
Helper.instance
end
# include text_helper as singleton
class Helper
include Singleton
include ActionView::Helpers::TextHelper
end
- Rob
--
http://www.robsanheim.com
http://www.seekingalpha.com
http://www.ajaxian.com
