Commit 59c95a9c7e576271dcd7e7f38bb64f7991937bf8

Authored by Arthur Neves
1 parent 8c7bcf33
Exists in master and in 1 other branch production

Use _action on controller

app/controllers/api/v1/stats_controller.rb
@@ -2,8 +2,8 @@ class Api::V1::StatsController < ApplicationController @@ -2,8 +2,8 @@ class Api::V1::StatsController < ApplicationController
2 respond_to :json, :xml 2 respond_to :json, :xml
3 3
4 # The stats API only requires an api_key for the given app. 4 # The stats API only requires an api_key for the given app.
5 - skip_before_filter :authenticate_user!  
6 - before_filter :require_api_key_or_authenticate_user! 5 + skip_before_action :authenticate_user!
  6 + before_action :require_api_key_or_authenticate_user!
7 7
8 def app 8 def app
9 if problem = @app.problems.order_by(:last_notice_at.desc).first 9 if problem = @app.problems.order_by(:last_notice_at.desc).first
app/controllers/application_controller.rb
1 class ApplicationController < ActionController::Base 1 class ApplicationController < ActionController::Base
2 protect_from_forgery 2 protect_from_forgery
3 3
4 - before_filter :authenticate_user_from_token!  
5 - before_filter :authenticate_user!  
6 - before_filter :set_time_zone 4 + before_action :authenticate_user_from_token!
  5 + before_action :authenticate_user!
  6 + before_action :set_time_zone
7 7
8 # Devise override - After login, if there is only one app, 8 # Devise override - After login, if there is only one app,
9 # redirect to that app's path instead of the root path (apps#index). 9 # redirect to that app's path instead of the root path (apps#index).
app/controllers/apps_controller.rb
@@ -2,9 +2,9 @@ class AppsController &lt; ApplicationController @@ -2,9 +2,9 @@ class AppsController &lt; ApplicationController
2 2
3 include ProblemsSearcher 3 include ProblemsSearcher
4 4
5 - before_filter :require_admin!, :except => [:index, :show]  
6 - before_filter :parse_email_at_notices_or_set_default, :only => [:create, :update]  
7 - before_filter :parse_notice_at_notices_or_set_default, :only => [:create, :update] 5 + before_action :require_admin!, :except => [:index, :show]
  6 + before_action :parse_email_at_notices_or_set_default, :only => [:create, :update]
  7 + before_action :parse_notice_at_notices_or_set_default, :only => [:create, :update]
8 respond_to :html 8 respond_to :html
9 9
10 expose(:app_scope) { 10 expose(:app_scope) {
app/controllers/comments_controller.rb
1 class CommentsController < ApplicationController 1 class CommentsController < ApplicationController
2 - before_filter :find_app  
3 - before_filter :find_problem 2 + before_action :find_app
  3 + before_action :find_problem
4 4
5 def create 5 def create
6 @comment = Comment.new(comment_params.merge(:user_id => current_user.id)) 6 @comment = Comment.new(comment_params.merge(:user_id => current_user.id))
app/controllers/deploys_controller.rb
@@ -2,8 +2,8 @@ class DeploysController &lt; ApplicationController @@ -2,8 +2,8 @@ class DeploysController &lt; ApplicationController
2 2
3 protect_from_forgery :except => :create 3 protect_from_forgery :except => :create
4 4
5 - skip_before_filter :verify_authenticity_token, :only => :create  
6 - skip_before_filter :authenticate_user!, :only => :create 5 + skip_before_action :verify_authenticity_token, :only => :create
  6 + skip_before_action :authenticate_user!, :only => :create
7 7
8 def create 8 def create
9 @app = App.find_by_api_key!(params[:api_key]) 9 @app = App.find_by_api_key!(params[:api_key])
app/controllers/notices_controller.rb
@@ -2,7 +2,7 @@ class NoticesController &lt; ApplicationController @@ -2,7 +2,7 @@ class NoticesController &lt; ApplicationController
2 2
3 class ParamsError < StandardError; end 3 class ParamsError < StandardError; end
4 4
5 - skip_before_filter :authenticate_user!, :only => :create 5 + skip_before_action :authenticate_user!, :only => :create
6 6
7 rescue_from ParamsError, :with => :bad_params 7 rescue_from ParamsError, :with => :bad_params
8 8
app/controllers/problems_controller.rb
@@ -8,7 +8,7 @@ class ProblemsController &lt; ApplicationController @@ -8,7 +8,7 @@ class ProblemsController &lt; ApplicationController
8 8
9 include ProblemsSearcher 9 include ProblemsSearcher
10 10
11 - before_filter :need_selected_problem, :only => [ 11 + before_action :need_selected_problem, :only => [
12 :resolve_several, :unresolve_several, :unmerge_several 12 :resolve_several, :unresolve_several, :unmerge_several
13 ] 13 ]
14 14
app/controllers/users_controller.rb
1 class UsersController < ApplicationController 1 class UsersController < ApplicationController
2 respond_to :html 2 respond_to :html
3 3
4 - before_filter :require_admin!, :except => [:edit, :update]  
5 - before_filter :require_user_edit_priviledges, :only => [:edit, :update] 4 + before_action :require_admin!, :except => [:edit, :update]
  5 + before_action :require_user_edit_priviledges, :only => [:edit, :update]
6 6
7 expose(:user, :attributes => :user_params) 7 expose(:user, :attributes => :user_params)
8 expose(:users) { 8 expose(:users) {
app/controllers/watchers_controller.rb
@@ -9,7 +9,7 @@ class WatchersController &lt; ApplicationController @@ -9,7 +9,7 @@ class WatchersController &lt; ApplicationController
9 app.watchers.where(:user_id => params[:id]).first 9 app.watchers.where(:user_id => params[:id]).first
10 end 10 end
11 11
12 - before_filter :require_watcher_edit_priviledges, :only => [:destroy] 12 + before_action :require_watcher_edit_priviledges, :only => [:destroy]
13 13
14 def destroy 14 def destroy
15 app.watchers.delete(watcher) 15 app.watchers.delete(watcher)