1
다음과 같이 간단한 렌더링이 있습니다.Rails 3 : RESTful 아키텍처에 따라 '삭제'로 작동하도록 form_for를 가져올 수 없음 => 항상 루팅 오류 발생
<%= form_for(:relationships, :url => relationships_path, :html => {:method => 'delete'}) do |f| %>
<div><%= f.hidden_field :user_id_to_unfollow, :value => @user.id %></div>
<div class="actions"><%= f.submit "Unfollow" %></div>
<% end %>
이 양식을 제출하면 항상 내 페이지에
Routing Error
No route matches "/relationships"
가 표시됩니다.
내 관계 컨트롤러에서 나는 모든 propers 메서드를 만들었습니다.
def create
...
end
def destroy
...
end
def update
...
end
def show
...
end
그리고 내 루트 구성에서 관계 컨트롤러의 모든 경로를 허용하도록 설정했습니다.
resources :relationships
(
:html => {:method => 'delete'}
메서드 매개 변수를 form_for에서 제거하면 컨트롤러 pb.
메서드가 생성됩니다.난 이해가 안돼 ....
알렉스
추신 : 이것은 관계에 대한 갈퀴 경로 결과입니다 :
relationships GET /relationships(.:format) {:action=>"index", :controller=>"relationships"}
POST /relationships(.:format) {:action=>"create", :controller=>"relationships"}
좋아, 난 당신이 무슨 뜻인지 볼? 그러나 나는 그것을 어떻게 할 것이냐? 나는 미안해 보이지 않는다. 나는 그 길을 파괴하기 위해 무엇을 바꾸어야할지 모른다. – Alex
@Alex : 예제 추가 – Heikki
Ohh woa .. 그 매력처럼 작동! 정말 고마워 ! – Alex