2016-04-12 3 views
1

Iている次のルートサブドメインが考案ルートで作業していない

constraints :subdomain => "brands" do 
    scope :module => "brands", :as => "brands" do 

     devise_for :members 

     # devise_for :users, controllers: { 
     # sessions: 'users/sessions' 
     # } 


    end 
    end 

私はで次のエラー

ActionController :: RoutingErrorを取得していますhttp://brands.lvh.me:3000/members/sign_upに行く/メンバー/ sign_up

未初期化ブランド:: RegistrationsControllerアプリケーション フレーム

ActionDispatch::Routing::RouteSet::Dispatcher#controller 
actionpack (4.2.5.2) lib/action_dispatch/routing/route_set.rb, line 63 

登録コントローラー - `アプリ/コントローラ/ブランド/メンバー/ registrations_controller.rb

class Brands::Members::RegistrationsController < Devise::RegistrationsController 
# before_action :configure_sign_up_params, only: [:create] 
# before_action :configure_account_update_params, only: [:update] 

    # GET /resource/sign_up 
    # def new 
    # super 
    # end 

    # POST /resource 
    # def create 
    # super 
    # end 

    # GET /resource/edit 
    # def edit 
    # super 
    # end 

    # PUT /resource 
    # def update 
    # super 
    # end 

    # DELETE /resource 
    # def destroy 
    # super 
    # end 

    # GET /resource/cancel 
    # Forces the session data which is usually expired after sign 
    # in to be expired now. This is useful if the user wants to 
    # cancel oauth signing in/up in the middle of the process, 
    # removing all OAuth session data. 
    # def cancel 
    # super 
    # end 

    # protected 

    # If you have extra params to permit, append them to the sanitizer. 
    # def configure_sign_up_params 
    # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute]) 
    # end 

    # If you have extra params to permit, append them to the sanitizer. 
    # def configure_account_update_params 
    # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute]) 
    # end 

    # The path used after sign up. 
    # def after_sign_up_path_for(resource) 
    # super(resource) 
    # end 

    # The path used after sign up for inactive accounts. 
    # def after_inactive_sign_up_path_for(resource) 
    # super(resource) 
    # end 
end 
+0

スコープ 'スコープ:module =>" brands "、:as =" brand "do"を削除するとうまくいくと思います。 –

+0

@MuhammadYawarAliしかし、私のコントローラとビューには名前が付いています –

+0

私のマルチテナントアプリでは、サブドメインとロケールのスコープはすべてあなたのように見えます。私が持っている唯一の違いは、私がオーバーライドしているコントローラの開発です。おそらく同じオーバーライドを行うことができますが、デバイスコントローラから継承した空のコントローラーを使用することができます。そして、ルートで 'devise_for:members、controllers:{:sessions =>" your_scope/sessions "}'と指定するだけです。 –

答えて

1

コメントからの回答:

は工夫の1を上書きするコントローラを作成します。必要なものを追加するか、Deviseコントローラから継承してください。

次に、あなたのルートに、あなたはあなただけで設定したコントローラを使用するために考案伝えることができます:

devise_for :members, controllers: {:sessions => "your_scope/sessions"} 

Devise doc (see section about configuring controllers and routes)

上記のコードでは、「your_scope」セクションを使用し、質問に関連しています特定の範囲。

考え::Deviseは、サブドメインとスコープのものを紛失している必要があります。コントローラーの位置と場所はわかりません。もし私が本当であれば、カスタムコントローラーの部分をスキップして、Deviseにそれ自身のデフォルトコントローラーを使用するように指示することもできます。要するに、範囲を忘れて古典的なデフォルトのメカニズムを使用するように工夫してください。

関連する問題