여러 모델을 다루는 양식을 쓰고 있습니다. 이 작업을 수행하는 방법에 대한 몇 가지 예는 ActionView::Helpers::FormHelper::label을 사용하고 일부는 ActionView::Helpers::FormTagHelper::label_tag을 사용합니다. 그 차이를 실제로 이해하지 못합니다.FormHelper :: label과 FormTagHelper :: label_tag의 차이점은 무엇입니까?
내 특정 경우, 모두 동일한 출력 결과를 보인다 :
<% form_for :post, :url => { :action => 'create' } do %>
<p>
<%= label_tag 'post_type' %><br />
<%= text_field :post, :post_type %>
</p>
<p>
<%= label :post, :parent_post_id %><br />
<%= text_field :post, :parent_post_id %>
</p>
...
가 렌더링 : 아마도 몇 가지 여분이 있기 때문에
<p>
<label for="post_type">Post type</label><br />
<input id="post_post_type" name="post[post_type]" size="30" type="text" />
</p>
<p>
<label for="post_parent_post_id">Parent post</label><br />
<input id="post_parent_post_id" name="post[parent_post_id]" size="30" type="text" />
</p>
라벨 도우미가 더 유용 할 것 같다 라벨링하는 모델과 속성을 알고 있기 때문에 할 수있는 일이 있지만이를 뒷받침 할만한 것을 찾을 수는 없습니다. 둘 사이에는 실제적인 차이가 있습니까? 다른 쪽 대신 도우미 한 명을 사용해야합니까?