Ruby on rails 设计用户的范围

Ruby on rails 设计用户的范围,ruby-on-rails,ruby,ruby-on-rails-3,devise,ruby-on-rails-3.2,Ruby On Rails,Ruby,Ruby On Rails 3,Devise,Ruby On Rails 3.2,使用Rails 3.2.13和Desive 2.2.3,我有一个普通用户可以登录并进入仪表板。当我用Desive创建了一个不同的用户,并使其具有不同的视图、控制器和模型时,它的行为方式不同。我甚至用与user相同的方式对关联user1进行了建模。现在我了解到我在范围界定设计模型方面遗漏了一些东西,也阅读了文档,但不知何故我未能实现它。user1可以注册,但是注册后,它会被重定向到home 以下是一些细节,如有疑问,将提供更多信息: 路线 日志 请指导我如何为user1实现相同的功能,以及如何确定

使用Rails 3.2.13和Desive 2.2.3,我有一个普通用户可以登录并进入仪表板。当我用Desive创建了一个不同的用户,并使其具有不同的视图、控制器和模型时,它的行为方式不同。我甚至用与user相同的方式对关联user1进行了建模。现在我了解到我在范围界定设计模型方面遗漏了一些东西,也阅读了文档,但不知何故我未能实现它。user1可以注册,但是注册后,它会被重定向到home

以下是一些细节,如有疑问,将提供更多信息:

路线 日志
请指导我如何为user1实现相同的功能,以及如何确定为user1开发的相同功能的范围

根据Desive文档,您可以为您的模型创建作用域路由。默认情况下,designe将首先查找作用域根路径,如果它不存在,它将重定向到默认根路径

作用域根路径为:{设计\模型\名称}\根\路径

考虑以下案例:

get 'user1/dashboard', :to => 'user1#dashboard', :as => :user1_root
有关更多信息,请参阅设计文档部分

希望这有帮助

Started POST "/user1" for 127.0.0.1 at 2014-06-03 10:58:58 +0530
Processing by Devise::RegistrationsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"yjG8AroaqqhCeyW9IDMNYHPV4+brvbdA3IlFNdf4Ecw=", "user1"=>{"email"=>"abc@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
   (0.3ms)  BEGIN
  User1 Exists (48.8ms)  SELECT 1 AS one FROM "user1" WHERE ""."email" = 'abc@gmail.com' LIMIT 1
  user1 Load (25.8ms)  SELECT "user1".* FROM "user1" WHERE "user1"."confirmation_token" = 'vzwnRygWM6HiPezPfPfq' LIMIT 1
  SQL (70.6ms)  INSERT INTO "user1" ("confirmation_sent_at", "confirmation_token", "confirmed_at", "created_at", "current_sign_in_at", "current_sign_in_ip", "email", "encrypted_password", "last_sign_in_at", "last_sign_in_ip", "name", "remember_created_at", "reset_password_sent_at", "reset_password_token", "role", "sign_in_count", "unconfirmed_email", "updated_at", "verified", "verified_by_admin") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20) RETURNING "id"  [["confirmation_sent_at", Tue, 03 Jun 2014 05:28:59 UTC +00:00], ["confirmation_token", "vzwnRygWM6HiPezPfPfq"], ["confirmed_at", nil], ["created_at", Tue, 03 Jun 2014 05:28:59 UTC +00:00], ["current_sign_in_at", nil], ["current_sign_in_ip", nil], ["email", "abc@gmail.com"], ["encrypted_password", "$2a$10$kwhkGjNd9ocZ3t.WUUZB4uGXFnpoDao9rHLD5rlEUR/iO0mVWQ1gS"], ["last_sign_in_at", nil], ["last_sign_in_ip", nil], ["name", ""], ["remember_created_at", nil], ["reset_password_sent_at", nil], ["reset_password_token", nil], ["role", nil], ["sign_in_count", 0], ["unconfirmed_email", nil], ["updated_at", Tue, 03 Jun 2014 05:28:59 UTC +00:00], ["verified", nil], ["verified_by_admin", nil]]
  Rendered user1/mailer/confirmation_instructions.html.erb (0.8ms)

Sent mail to abc@gmail.com (63ms)
Date: Tue, 03 Jun 2014 10:58:59 +0530
From: notifications@filmzu.com
To: abc@gmail.com
Message-ID: <538d5d1b7df6a_12b040fc01814856@pc3.mail>
Subject: Confirmation instructions
Mime-Version: 1.0
Content-Type: text/html;

<p>You can confirm your account email through the link below:</p>

<p><a href="">Confirm my account</a></p>

Sent mail to abc@gmail.com (2ms)
Date: Tue, 03 Jun 2014 10:58:59 +0530
To: abc@gmail.com
Message-ID: <538d5d1b8d81d_12b040fc01814951@pc3.mail>
Subject: Sign Up Confirmation
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit


   (53.7ms)  COMMIT
Redirected to http://localhost:3000/
Completed 302 Found in 882ms (ActiveRecord: 0.0ms)


Started GET "/" for 127.0.0.1 at 2014-06-03 10:58:59 +0530
Processing by HomeController#index as HTML
  Rendered application/_cta.html.erb (0.0ms)
  Rendered home/index.html.erb within layouts/application (2.7ms)
  Rendered application/_header.html.erb (0.5ms)
  Rendered application/_footer.html.erb (0.8ms)
Completed 200 OK in 67ms (Views: 66.1ms | ActiveRecord: 0.0ms)
get 'user1/dashboard', :to => 'user1#dashboard', :as => :user1_root