2017-08-21 1 views
0

を設定した後、私は工夫フラッシュメッセージは、その後動作していないが、このソリューション How to Setup Multiple Devise User Modelsフラッシュメッセージ複数考案ユーザーモデル

を実装し、私が試してみましたまだこのライン flash.clearけどをreemovingフラッシュメッセージが表示されていません。

# ../controllers/concerns/accessible.rb 
module Accessible 
    extend ActiveSupport::Concern 
    included do 
    before_action :check_user 
end 

protected 
def check_user 
flash.clear 
if current_tenant 

    redirect_to(authenticated_tenant_root_path) && return 
    elsif current_user 

    redirect_to(authenticated_user_root_path) && return 
    end 
end 
end 

答えて

0

Deviseのローカリゼーションを変更しようとしましたか?モデルに適切なキーがない可能性があります。これは次のようなものです:

en: 
devise: 
    failure: 
    user: 
    invalid: 'Welcome user, you are signed in.' 
    not_found: 'User not found.' 
    admin: 
    invalid: 'Invalid admin credentials' 
    not_found: 'Admin not found' 

希望しますか?

0

工夫stored_location_for私のためにそれを固定し、ここhttp://www.rubydoc.info/github/plataformatec/devise/Devise/Controllers/StoreLocation

module Accessible 
    extend ActiveSupport::Concern 
    included do 
    before_action :check_user 
    end 

    protected 
    def check_user 
    if current_tenant 
     redirect_to stored_location_for(:tenant) || 
authenticated_tenant_root_url && return 
    elsif current_user 
    redirect_to stored_location_for(:user) || 
    authenticated_user_root_url && return 
    end 
    end 
end 
インスタンスメソッドを見つけました
関連する問題