use before_action only for Rails >= 5
conditional branch on `Rails::VERSION::MAJOR` for backwards compatibility
This commit is contained in:
parent
51c054e200
commit
6cd542df7a
|
@ -3,13 +3,21 @@ require 'digest/sha2'
|
||||||
module ImpressionistController
|
module ImpressionistController
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
def impressionist(opts={})
|
def impressionist(opts={})
|
||||||
before_action { |c| c.impressionist_subapp_filter(opts) }
|
if Rails::VERSION::MAJOR >= 5
|
||||||
|
before_action { |c| c.impressionist_subapp_filter(opts) }
|
||||||
|
else
|
||||||
|
before_filter { |c| c.impressionist_subapp_filter(opts) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module InstanceMethods
|
module InstanceMethods
|
||||||
def self.included(base)
|
def self.included(base)
|
||||||
base.before_action :impressionist_app_filter
|
if Rails::VERSION::MAJOR >= 5
|
||||||
|
base.before_action :impressionist_app_filter
|
||||||
|
else
|
||||||
|
base.before_filter :impressionist_app_filter
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def impressionist(obj,message=nil,opts={})
|
def impressionist(obj,message=nil,opts={})
|
||||||
|
|
Loading…
Reference in New Issue