내가 돈 '이 내 비 발판 컨트롤러에서 편집 작업입니다
Effcnt::Application.routes.draw do
get "ravs/index"
get "ravs/edit"
get "ravs/_dec"
resources :achvrs
: 이것은 내 routes.rb입니다
<%= form_tag(:controller=> "ravs", :method=> "get", :action=> "edit", :class=> "_dec") %>
<div >
<%= submit_tag(:controller=> "achvrs", :method=> "put", :action=> "update") %>
</div>
<% end %>
귀하의 코드가 작동한다고 생각하지 마십시오. (rails2.3.x에서 3.2) API를 레일에 따른 때문에, "submit_tag는"이 태그 지원이 무엇인지 당신이 제공하는 옵션 (
<%= submit_tag(:controller=> "achvrs", :method=> "put", :action=> "update") %>
)를 가지고 있지 않습니다
:confirm => 'question?' - This will add a JavaScript confirm prompt with the question specified. If the user accepts, the form is processed normally, otherwise no action is taken.
:disabled - If true, the user will not be able to use this input.
:disable_with - Value of this parameter will be used as the value for a disabled version of the submit button when the form is submitted.
Any other key creates standard HTML options for the tag.
또한 구현 코드가 이해할 수 없다고 생각합니다. 양식은 1 개의 대상 (some_controller # some_action)에만 제출할 수 있지만 한 번에 2 개의 작업에 양식을 제출하려는 것 같습니다.
그래서, 난 당신이 더 나은 레일 'MVC의 방법으로 코드를 작성했다 생각 : 나는 당신이 바로, 당신이 원하는 이해한다면
def the_action_your_form_submitted_to
# previously it was called in your RESTful action
do_task_no.1
# previously it was called in your non-RESTful action
do_task_no.2
end
나는 신중하게 보지 못했지만 부분을 독립형 페이지로 렌더링하려는 경우는 없을 것이라고 생각합니다. 부분은 재사용 가능한 뷰 "함수"의 일종으로 간주됩니다. Rails가 페이지를 조합하는 작업을 수행하게합니다 (레이아웃부터 시작하여 특정보기 및 해당 부분 또는 부분을 시작). –