diff --git a/README.rst b/README.rst index 4a46ce01..7b6af171 100644 --- a/README.rst +++ b/README.rst @@ -531,7 +531,7 @@ default_version validate Parameters validation is turned off when set to false. When set to ``:explicitly``, you must invoke parameter validation yourself by calling - controller method ``apipie_validations`` (typically in a before_filter). + controller method ``apipie_validations`` (typically in a before_action). When set to ``:implicitly`` (or just true), your controller's action methods are wrapped with generated methods which call ``apipie_validations``, and then call the action method. (``:implicitly`` by default) @@ -729,17 +729,17 @@ is raised and can be rescued and processed. It contains a description of the parameter value expectations. Validations can be turned off in the configuration file. -Parameter validation normally happens after before_filters, just before +Parameter validation normally happens after before_actions, just before your controller method is invoked. If you prefer to control when parameter validation occurs, set the configuration parameter ``validate`` to ``:explicitly``. You must then call the ``apipie_validations`` method yourself, e.g.: .. code:: ruby - before_filter: :apipie_validations + before_action: :apipie_validations -This is useful if you have before_filters which use parameter values: just add them -after the ``apipie_validations`` before_filter. +This is useful if you have before_actions which use parameter values: just add them +after the ``apipie_validations`` before_action. TypeValidator ------------- diff --git a/app/controllers/apipie/apipies_controller.rb b/app/controllers/apipie/apipies_controller.rb index a37a42ee..34b775eb 100644 --- a/app/controllers/apipie/apipies_controller.rb +++ b/app/controllers/apipie/apipies_controller.rb @@ -5,8 +5,8 @@ class ApipiesController < ActionController::Base layout Apipie.configuration.layout - around_filter :set_script_name - before_filter :authenticate + around_action :set_script_name + before_action :authenticate def authenticate if Apipie.configuration.authenticate diff --git a/lib/apipie/extractor.rb b/lib/apipie/extractor.rb index 00f029e9..e2934bf4 100644 --- a/lib/apipie/extractor.rb +++ b/lib/apipie/extractor.rb @@ -9,8 +9,7 @@ class Apipie::Railtie initializer 'apipie.extractor' do |app| ActiveSupport.on_load :action_controller do - create_filter_method = respond_to?(:before_action) ? :before_action : :before_filter - send(create_filter_method) do |controller| + before_action do |controller| if Apipie.configuration.record Apipie::Extractor.call_recorder.analyse_controller(controller) end diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb index e31d73e4..65382d2a 100644 --- a/spec/dummy/app/controllers/application_controller.rb +++ b/spec/dummy/app/controllers/application_controller.rb @@ -1,5 +1,5 @@ class ApplicationController < ActionController::Base - before_filter :run_validations + before_action :run_validations resource_description do param :oauth, String, :desc => "Authorization", :required => false