Sha256: a58ff2331453a7a038a4719f52618812afdcc16752b34185dd634cc6395ab821
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
module Wanko module Helpers module UrlHelper #FIXME there has to be a better way doing this... def method_missing(meth, *args, &block) if main_app.routes.url_helpers.instance_methods.include? meth main_app.send meth, *args, &block else super end end end end module Controller extend ActiveSupport::Concern included do helper Wanko::Helpers::UrlHelper end end module AbstractController def send_action(method_name, *args) if self.is_a?(Wanko::Controller) begin super @_wanko_action_successfully_finished = true rescue => e #TODO error handling p e end else if env.key? 'wanko_render_result' headers.delete 'X-Cascade' ret = env.delete 'wanko_render_result' self.response_body = ret else super end end end end module ActionController def process_action(*args) if self.is_a?(Wanko::Controller) headers['X-Cascade'] = 'pass' if self.class.parent::Engine.active?(self) super end else super end end def render_to_body(options = {}) return if (headers['X-Cascade'] == 'pass') && !defined?(@_wanko_action_successfully_finished) env['wanko_render_result'] = super end end end AbstractController::Base.prepend Wanko::AbstractController ActionController::Base.prepend Wanko::ActionController
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wanko-0.0.1 | lib/wanko/abstract_controller.rb |