Sha256: 4c70ed8f3f9a307f74d8821e00e973edc829815a9ff49d14bbf8865a635f78d5

Contents?: true

Size: 552 Bytes

Versions: 8

Compression:

Stored size: 552 Bytes

Contents

require 'motorhead/engine'

module RoadCrew
  class Engine < ::Rails::Engine
    include Motorhead::Engine

    active_if { true }
    mount_at 'motorhead/road_crew'

    Motorhead::Engine::ClassMethods.class_eval do
      # overwrite active? to check cookie value as well
      def active?(controller)
        if (settings = controller.send(:cookies)['road_crew_engine_settings'])
          return false if JSON.parse(settings)[controller.class.parent.name] == '0'
        end
        controller.instance_eval(&@active_if)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
motorhead-0.3.7 lib/motorhead/road_crew/lib/road_crew/engine.rb
motorhead-0.3.6 lib/motorhead/road_crew/lib/road_crew/engine.rb
motorhead-0.3.5 lib/motorhead/road_crew/lib/road_crew/engine.rb
motorhead-0.3.4 lib/motorhead/road_crew/lib/road_crew/engine.rb
motorhead-0.3.3 lib/motorhead/road_crew/lib/road_crew/engine.rb
motorhead-0.3.2 lib/motorhead/road_crew/lib/road_crew/engine.rb
motorhead-0.3.1 lib/motorhead/road_crew/lib/road_crew/engine.rb
motorhead-0.3.0 lib/motorhead/road_crew/lib/road_crew/engine.rb