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 ClassMethods
|
||||
def impressionist(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
|
||||
|
||||
module InstanceMethods
|
||||
def self.included(base)
|
||||
if Rails::VERSION::MAJOR >= 5
|
||||
base.before_action :impressionist_app_filter
|
||||
else
|
||||
base.before_filter :impressionist_app_filter
|
||||
end
|
||||
end
|
||||
|
||||
def impressionist(obj,message=nil,opts={})
|
||||
|
|
Loading…
Reference in New Issue