Sha256: 3dba68b1a13ade30d462ed3c05acb8e8df45a79019edaed1cc9a79de047b30e8

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module ReactiveRuby
  module Rails
    class Railtie < ::Rails::Railtie
      config.before_configuration do |app|
        app.config.assets.enabled = true
        app.config.assets.paths << ::Rails.root.join('app', 'views').to_s
        app.config.react.server_renderer =
          ReactiveRuby::ServerRendering::ContextualRenderer
        app.config.react.view_helper_implementation =
          ReactiveRuby::Rails::ComponentMount
      end
      config.after_initialize do
        ::ApplicationController.class_eval do
          before_action do
            if params.has_key? 'hyperloop-prerendering'
              params['hyperloop-prerendering'].to_s == 'on'
            elsif params.has_key? 'hyperloop_prerendering'
              params['hyperloop_prerendering'].to_s == 'on'
            else
              Hyperloop.prerendering.to_s == 'on'
            end && next
            params[:no_prerender] = '1'
          end
        end
        class ::HyperloopController < ::ApplicationController
          def action_missing(name)
            render_component
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hyper-react-0.12.7 lib/reactive-ruby/rails/railtie.rb