ruby on rails 3 - devise 2 models 2 views problem with path -


context:

rails 3.0.3

devise 1.1.5 , 1.2rc

i have following devise rdoc

rails g devise:install  rails g devise user  rails g devise employee  rails g devise:views users  rails g devise:views employees 

routes.rb

devise_for :users

devise_for :employees, :path => 'admin'

devise.rb

config.scoped_views = true

rake routes gives

new_user_session /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}

                user_session post   /users/sign_in(.:format)                        {:action=>"create", :controller=>"devise/sessions"}          destroy_user_session    /users/sign_out(.:format)                       {:action=>"destroy", :controller=>"devise/sessions"}                 user_password post   /users/password(.:format)                       {:action=>"create", :controller=>"devise/passwords"}             new_user_password    /users/password/new(.:format)                   {:action=>"new", :controller=>"devise/passwords"}            edit_user_password    /users/password/edit(.:format)                  {:action=>"edit", :controller=>"devise/passwords"}                               put    /users/password(.:format)                       {:action=>"update", :controller=>"devise/passwords"}                   user_unlock post   /users/unlock(.:format)                         {:action=>"create", :controller=>"devise/unlocks"}               new_user_unlock    /users/unlock/new(.:format)                     {:action=>"new", :controller=>"devise/unlocks"}                                  /users/unlock(.:format)                         {:action=>"show", :controller=>"devise/unlocks"}          new_employee_session    /admin/sign_in(.:format)                        {:action=>"new", :controller=>"devise/sessions"}              employee_session post   /admin/sign_in(.:format)                        {:action=>"create", :controller=>"devise/sessions"}      destroy_employee_session    /admin/sign_out(.:format)                       {:action=>"destroy", :controller=>"devise/sessions"}             employee_password post   /admin/password(.:format)                       {:action=>"create", :controller=>"devise/passwords"}         new_employee_password    /admin/password/new(.:format)                   {:action=>"new", :controller=>"devise/passwords"}        edit_employee_password    /admin/password/edit(.:format)                  {:action=>"edit", :controller=>"devise/passwords"}                               put    /admin/password(.:format)                       {:action=>"update", :controller=>"devise/passwords"} 

a mailer views users or employees are

link_to 'change password', edit_user_password_url(@resource, :reset_password_token => @resource.reset_password_token)

link_to 'change password', edit_employee_password_url(@resource, :reset_password_token => @resource.reset_password_token)

but if submit form have error (for user or employee)

typeerror in devise/passwords#create

showing /app/views/users/mailer/reset_password_instructions.html.erb line #8 raised:

can't convert string hash

8: <%= link_to 'change password', edit_employee_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>

if have idea ?

initialy posted mar 7 2011

the solution in application_controller.rb.

add

actionmailer::base.default_url_options[:host] = "http://domain.com"


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -