양식에 대한 제출, 취소 및 삭제 작업의 일반 세트를 만들려고합니다. 이 시점에서 나는 모든 것이 작동하고있는 것을 제외하고는, 유효성 검사 오류로 인해 양식이 다시로드되는 것을 제외하고는 :back
기능을 잃어버린 것 같습니다. 유효성 검사가 실패했다는 사실을 알 수있는 방법이 있습니까?이 경우 모든 컨트롤러를 편집하지 않고 request.env['HTTP_REFERER']
또는 :back
값을 동일하게 유지합니까?레일 : 일반 양식 작업, 유효성 검사 실패시 링크 취소 ': back`
= simple_form_for @announcement do |f|
= f.error_notification
= f.input :message
= f.input :starts_at
= f.input :ends_at
#submit
= f.button :submit
= "or "
= link_to("cancel", url_for(:back))
.right
- if !f.object.new_record?
- resource = (f.object.class.name).downcase
= link_to "destroy", url_for(:action => 'destroy'), :confirm => "Are you sure that you want to delete this #{resource}?", :method => :delete
.clear
.non_input
#post_back_msg
#indicator.inline
= image_tag "indicator.gif"
.inline
= "Please wait..."
.non_input
이 방법이 유용 할 수 있지만 '@previous'는 비어 있어야합니까? –
유효성 검사에 실패하면 @previous = "" – jschorr
Perfect로 설정합니다. 감사!!! –