Sha256: 4f27abd9c21edd807deaadeaaeca9097d5dcb70d7f4e00c47d10ca03ebd69b69

Contents?: true

Size: 901 Bytes

Versions: 12

Compression:

Stored size: 901 Bytes

Contents

module React
  module Rails
    module ControllerLifecycle
      extend ActiveSupport::Concern

      included do
        # use both names to support Rails 3..5
        before_action_with_fallback = respond_to?(:before_action) ? :before_action : :before_filter
        after_action_with_fallback = respond_to?(:after_action) ? :after_action : :after_filter
        public_send(before_action_with_fallback, :setup_react_component_helper)
        public_send(after_action_with_fallback, :teardown_react_component_helper)
        attr_reader :__react_component_helper
      end

      def setup_react_component_helper
        new_helper = React::Rails::ViewHelper.helper_implementation_class.new
        new_helper.setup(self)
        @__react_component_helper = new_helper
      end

      def teardown_react_component_helper
        @__react_component_helper.teardown(self)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
react-rails-1.11.0 lib/react/rails/controller_lifecycle.rb
react-rails-1.10.0 lib/react/rails/controller_lifecycle.rb
react-rails-1.9.0 lib/react/rails/controller_lifecycle.rb
react-rails-1.8.2 lib/react/rails/controller_lifecycle.rb
react-rails-1.8.1 lib/react/rails/controller_lifecycle.rb
react-rails-1.8.0 lib/react/rails/controller_lifecycle.rb
react-rails-1.7.2 lib/react/rails/controller_lifecycle.rb
react-rails-1.7.1 lib/react/rails/controller_lifecycle.rb
react-rails-1.7.0 lib/react/rails/controller_lifecycle.rb
react-rails-1.6.2 lib/react/rails/controller_lifecycle.rb
react-rails-1.6.1 lib/react/rails/controller_lifecycle.rb
react-rails-1.6.0 lib/react/rails/controller_lifecycle.rb