devise 2 models 2 views problem with path
context:
rails 3.0.3
devise 1.1.5 and 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 GET /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}
user_session POST /users/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"} destroy_user_session GET /users/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"} user_password POST /users/password(.:format) {:action=>"create", :controller=>"devise/passwords"} new_user_password GET /users/password/new(.:format) {:action=>"new", :controller=>"devise/passwords"} edit_user_password GET /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", :contro开发者_如何学JAVAller=>"devise/unlocks"} new_user_unlock GET /users/unlock/new(.:format) {:action=>"new", :controller=>"devise/unlocks"} GET /users/unlock(.:format) {:action=>"show", :controller=>"devise/unlocks"} new_employee_session GET /admin/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"} employee_session POST /admin/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"} destroy_employee_session GET /admin/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"} employee_password POST /admin/password(.:format) {:action=>"create", :controller=>"devise/passwords"} new_employee_password GET /admin/password/new(.:format) {:action=>"new", :controller=>"devise/passwords"} edit_employee_password GET /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 my password', edit_user_password_url(@resource, :reset_password_token => @resource.reset_password_token)
link_to 'Change my password', edit_employee_password_url(@resource, :reset_password_token => @resource.reset_password_token)
But if i submit form i have this error (for user or employee)
TypeError in Devise/passwords#create
Showing /app/views/users/mailer/reset_password_instructions.html.erb where line #8 raised:
can't convert String into Hash
8: <%= link_to 'Change my password', edit_employee_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
if you have an idea ?
Initialy posted Mar 7 2011
The solution are in application_controller.rb.
add
ActionMailer::Base.default_url_options[:host] = "http://domain.com"
精彩评论