可以使用,除非在before_action语句,那么unauthentication用户可以看到任何色器件控制器动作
class ApplicationController < ActionController::Base
...
before_filter :sending_params
before_action :check_auth, unless: :devise_controller?
...
protected
def check_auth
unless user_signed_in?
redirect_to new_user_session_path(sending_params)
end
end
def sending_params
params.permit(:first_param, :second_param)
end
...
,并且可以访问到PARAMS不产生由生成设计的控制器设计的观点和看法使用
<%= params[:first_param] %>
如果需要将参数发送到omniauth控制器,您可以在设计视图中更改链接
<%= link_to 'Sign in by provider', omniauth_authorize_path(:user, :provider, first_param: params['first_param']) %>
其中:用户 - 名色器件模型,:供应商 - 名omniauth提供商(:Facebook的即)
在omniauth控制器,你可以使用
def first_param
request.env['omniauth.params']['first_param'] ||= ''
end
难道我的回答解决了问题? –