所以我有ApplicationController.rb:
class ApplicationController < ActionController::Base
protect_from_forgery
def decode_email
params[:email] = URI::decode(params[:email])
end
end
然后是 UsersController.rb:
class UsersController < ApplicationController
before_filter :decode_email, only: [:show]
def show
#blah blah
end
end
现在点击显示动作会导致:
undefined local variable or method 'decode_email' for #<UsersController:0x007fb5f216a710>
为什么不继承该方法以便可以将其正确用作 before_filter?