设计2个模型2视图路径问题

时间:2011-02-09 19:17:35

标签: ruby-on-rails-3 devise

上下文

  

rails 3.0.3

     

设计 1.1.5和1.2rc

我有以下设计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 => '管理员'

devise.rb

  

config.scoped_views = true

rake routes给出

  

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 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", :controller=>"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"}

邮件查看用户或员工

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)

但是如果我提交表单我有这个错误( for user or employee

  

Devise / passwords中的TypeError #create

     

显示/app/views/users/mailer/reset_password_instructions.html.erb第8行:

     

无法将String转换为Hash

     

8:<%= link_to'更改我的密码',edit_employee_password_url(@resource,:reset_password_token => @ resource.reset_password_token)%>

如果你有想法?

1 个答案:

答案 0 :(得分:1)

最初发布于2011年3月7日

解决方案在application_controller.rb。

添加

ActionMailer::Base.default_url_options[:host] = "http://domain.com"