2013-10-27 5 views
0

나는 RegistrationController라는 컨트롤러를 가지고 있습니다. 경로는 다음과 같이 정의된다 : 위의 라인이 작동하고 다음과 같은 오류가 제공되지url 매개 변수에 form_for 오류가 발생했습니다.

<%= form_for :registration, url:registration/create do |f| %> 

:

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

답변

1

시도

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

new.erb은 다음 줄을 포함 Ruby는 URL 대신 문자열을 사용하므로이를 루비로 해석하지 않습니다.

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

에 해당이 있습니까! –

+0

@johndoe '등록'모델을 질문에 게시 할 수 있습니까? – jvperrin

+0

좋습니다. 이렇게 혼란 스럽습니다. 내 모델 이름은 사용자이므로 form_for를 입력해야합니까? user ??? –

0

구성/경로에는 무엇이 있습니까?
이 같은 오류가 있음을 했 당신이

resources :registration, only: [:new, :create, :index] 
관련 문제