我是新來的rails。 使用導軌4和設計。我試圖用一個名爲role的類變量來使用單用戶模型,這將決定用戶是客戶還是管理員。Rails設計額外用戶註冊
我創建了/views/devise/registrations/new.html.erb 的副本:/views/devise/registrations/sign_up2.html.erb
,然後在我的routes.rb中添加:
devise_scope :user do
get "users/sign_up2"=> "devise/registrations#sign_up2", :as => "sign_up2"
end
但是我不斷收到錯誤:
First argument in form cannot contain nil or be empty
我有一個客戶註冊控制器(在控制器/用戶/ registration_controller.rb)
class Users::RegistrationsController < Devise::RegistrationsController
include ApplicationHelper
def sign_up_params
params.require(:user).permit(:first_name, :last_name, :profile_name, :role, :email, :password, :password_confirmation)
end
末