回答一个问题:
我的要求如下:
如果用户访问我的申请,那么,我寄望的根基就落到宣传页和纸张上;签名表格。 通过检查子库的存在来实现这一点。
如果用户没有入住,并试图在测试时访问其账户。 我的赞同。 -aka-设计/会议
如果用户在(发展中国家)和访问测试中被贴上标签。 申请的根基是应用仪表板。
Here is what I am trying to use in my routes.rb
constraints(Subdomain) do
authenticated do
root :to => dashboard#index
end
root :to => devise/sessions#new
end
root :to => promo_pages#index
现在我有以下内容,你将指出,设计范围没有包括在内。
constraints(Subdomain) do
authenticated do
root :to => dashboard#index
end
end
root :to => promo_pages#index
My problem with the latter is that when a user who is not logged in first visits test.myapp.com they are redirected to test.myapp.com/users/sign_in and an error message is displayed saying "You need to sign in or sign up before continuing." This is because I am enforcing a logon requirement for the dashboard pages.
However I don t want the user to get an error message the first time they visit the page, as it is ugly and makes it look like they have done something wrong when they have not.
My expectation is that if the user is not logged in then they will be directed straight to the logon page and not get an error notification. But when I use my amended version the following happens, I can visit myapp.com just fine and it is routed to the promo pages but if I try to visit test.myapp.com I get the following message in the browser
**Unknown action**
Could not find devise mapping for path "/". Maybe you forgot to wrap your route inside the scope block? For example: devise_scope :user do match "/some/route" => "some_devise_controller" end
请告诉我正在做什么错误(如果有的话),因为我正在试图理解什么。
Ps: I have found similar errors in stackoverflow and various googling but the solutions just don t seem to work for me. I expect that the solution to the problem lies in the error message that I have included above, but I can t figure out how to apply it.
Finally here is the log entry version of the error above, it is in an easier to read form.
Started GET "/" for 127.0.0.1 at 2012-01-15 21:44:42 +0000
Processing by Devise::SessionsController#new as HTML
[Devise] Could not find devise mapping for path "/".
Maybe you forgot to wrap your route inside the scope block? For example:
devise_scope :user do
match "/some/route" => "some_devise_controller"
end
Completed 404 Not Found in 1ms
AbstractController::ActionNotFound (Could not find devise mapping for path "/".
Maybe you forgot to wrap your route inside the scope block? For example:
devise_scope :user do
match "/some/route" => "some_devise_controller"
end
):
All help is appreciated, and additional details can be provided.
阅读
<>Update>
I have just noticed that the authenticated check does not appear to be working. If it was working correctly then when using the second batch of working config, the logged in user visiting test.myapp.com would always be directed to the promo_pages, whereas at the moment he is able to access the dashboard..
I found the devise authenticated method here https://github.com/plataformatec/devise/pull/1147