lib/pjax.rb in pjax_rails-0.4.0 vs lib/pjax.rb in pjax_rails-0.5.0

- old
+ new

@@ -5,12 +5,17 @@ layout proc { |c| pjax_request? ? pjax_layout : nil } helper_method :pjax_request? rescue_from Pjax::Unsupported, :with => :pjax_unsupported - before_filter :strip_pjax_param, :if => :pjax_request? - before_filter :set_pjax_url, :if => :pjax_request? + if respond_to? :before_action + before_action :strip_pjax_param, :if => :pjax_request? + before_action :set_pjax_url, :if => :pjax_request? + else + before_filter :strip_pjax_param, :if => :pjax_request? + before_filter :set_pjax_url, :if => :pjax_request? + end end class Error < StandardError; end class Unsupported < Error; end @@ -30,14 +35,14 @@ def pjax_unsupported head :not_acceptable end - # Call in a before_filter or in an action to disable pjax on an action. + # Call in a before_action or in an action to disable pjax on an action. # # Examples # - # before_filter :prevent_pjax! + # before_action :prevent_pjax! # # def login # prevent_pjax! # # ... # end