ruby on rails - Scoping a devise user -


working rails 3.2.13 , devise 2.2.3, have normal user can login , enter dashboard. when created different user devise , made it's separate views, controllers , models, isn't acting same way. have modeled association user1 same way user. understand missing scoping devise models, read documentation somehow fail achieve it. user1 signs-up fine, upon signing up, it's redirected home.

following of details, more provided on asking:

routes

 devise_for :user1   match 'user1/sign_up' => 'user1#new'   match 'user1/dashboard' => 'user1#dashboard' 

logs

started post "/user1" 127.0.0.1 @ 2014-06-03 10:58:58 +0530 processing devise::registrationscontroller#create 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 one "user1" ""."email" = 'abc@gmail.com' limit 1   user1 load (25.8ms)  select "user1".* "user1" "user1"."confirmation_token" = 'vzwnrygwm6hipezpfpfq' limit 1   sql (70.6ms)  insert "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 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 account email through link below:</p>  <p><a href="">confirm account</a></p>  sent mail 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 confirmation mime-version: 1.0 content-type: text/plain;  charset=utf-8 content-transfer-encoding: 7bit      (53.7ms)  commit redirected http://localhost:3000/ completed 302 found in 882ms (activerecord: 0.0ms)   started "/" 127.0.0.1 @ 2014-06-03 10:58:59 +0530 processing homecontroller#index 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) 

please guide me how can achieve same user1, , how scope same thing developed user user1.

according devise documentation can create scoped routes models. default devise scoped root_path first, , if doesn't exist redirect default root.

scoped root path is: "#{devise_model_name}_root_path"

consider following example case:

get 'user1/dashboard', :to => 'user1#dashboard', :as => :user1_root 

more info @ controller filter , helper section of devise docs.

hope helps!


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -