draper/lib/draper/lazy_helpers.rb

16 lines
408 B
Ruby
Raw Normal View History

2011-07-13 05:00:10 +00:00
module Draper
2013-01-07 16:33:24 +00:00
# Include this module in your decorators to get direct access to the helpers
# so that you can stop typing `h.` everywhere, at the cost of mixing in a
# bazillion methods.
2011-07-13 05:00:10 +00:00
module LazyHelpers
2013-01-07 16:33:24 +00:00
# Sends missing methods to the {HelperProxy}.
def method_missing(method, *args, &block)
helpers.send(method, *args, &block)
rescue NoMethodError
super
2011-07-13 05:00:10 +00:00
end
2013-01-07 16:33:24 +00:00
2011-07-13 05:00:10 +00:00
end
2012-04-25 20:12:30 +00:00
end