From 7baedff58670e7232544a8c03aba26d931d5d1ce Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Sun, 26 Aug 2012 10:18:13 -0700 Subject: [PATCH] Adding 'mount' property to Jasminerice module, so that applications can control whether to automatically mount the Jasminerice engine in their application. Defaults to true. This is useful when the application including the engine wants to mount the engine itself in its own routes.rb, so that it can control the order it is mounted in (to mount it above a wildcard-matching route, for instance). --- config/routes.rb | 6 ++++-- lib/jasminerice.rb | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 8a2c03b..1147b0b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,8 @@ root :to => "spec#index" end -Rails.application.routes.draw do - mount Jasminerice::Engine => "/jasmine" +if Jasminerice.mount + Rails.application.routes.draw do + mount Jasminerice::Engine => "/jasmine" + end end diff --git a/lib/jasminerice.rb b/lib/jasminerice.rb index 867f4ff..51bbe2d 100644 --- a/lib/jasminerice.rb +++ b/lib/jasminerice.rb @@ -2,4 +2,6 @@ require 'haml' module Jasminerice + mattr_accessor :mount + self.mount = true end