2013-10-27 58 views
0

我有一個叫這個RegistrationController控制器。該路線的定義是這樣的:的form_for給錯誤的URL參數

get "registration/index" 
    get "registration/create" 
    get "registration/new" 

的new.erb包含以下行:

上述行不工作,並給予了以下錯誤:

undefined local variable or method `registration' for #<#<Class:0x007fd382a810d0>:0x007fd38296dd38> 

回答

1

嘗試使用的URL字符串代替,所以Ruby沒有把它解釋爲一種方法:

<%= form_for :user, url: 'registration/create' do |f| %> 
+0

相當於難道是同樣的錯誤! –

+0

@johndoe你可以在你的問題中發佈你的'Registration'模型嗎? – jvperrin

+0

好吧,這是令人困惑的。我的模型名稱是用戶,所以我應該輸入form_for:user ??? –

0

你有什麼在配置/路由?
你有

resources :registration, only: [:new, :create, :index]