Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace #before_filter with #before_action #420

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,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)
Expand Down Expand Up @@ -726,17 +726,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
-------------
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/apipie/apipies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/apipie/extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class Apipie::Railtie
initializer 'apipie.extractor' do |app|
ActiveSupport.on_load :action_controller do
before_filter do |controller|
before_action do |controller|
if Apipie.configuration.record
Apipie::Extractor.call_recorder.analyse_controller(controller)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down