1
標準の選択ボックスを追加するためのrfqs/_form_new.html.erbのコードは次のとおりです。link_to_functionは、レール3.1.0とシンプルフォームでクリックに反応しません
<%= simple_form_for @rfq do |f| %>
<div id="std">
<%= render :partial => 'standards/standards', :collection => @rfq.standards, :locals => { :f => f } %>
</div>
<%= link_to_function "Add Std", nil do |page| %>
page.insert_html :bottom, :std, :partial => 'standards/standards'
<% end %>
<% end %>
htmlソースコードはhrefの後に#があり、リンクをクリックしても反応しません。
<a href="#" onclick="; return false;">Add Std</a>
_standards.html.erb部分的に見えるように:hrefの後にリンクを逃すについて
<%= f.association :standards, :collection => Standard.active_std.all(:order => 'name'), :label_method => :name, :value_method => :id %>
任意の考え?ありがとう。
rails 3.1.0以降でlink_to_functionについて新しいAPI定義がありますか?私はlink_to_functionに関するオンラインapiの定義を読み、レール3.0.9で停止した緑色のバーに気づいた。しかし、私は、レール3.1.0以降でlink_to_functionに関する情報を見つけられませんでした。ありがとう。 – user938363
@ user938363 apidock.comには3.1があるようですが、誤読されている可能性があります。 –
@ user938363(それは、あなたがローカルで利用可能なバージョンのソースを持つことは本当に重要だと言いました。それは価値のある唯一の実際のドキュメントです)。 –