将哈希键传递给控制器

时间:2013-10-14 11:39:00

标签: ruby-on-rails ruby-on-rails-2

我在Rails 2.x中有这段代码:

<div class="label-field-pair">
    <label><%= t('select_a_course_batch') %></label>
    <div class="text-input-bg"> <%= select :fees_submission, :batch_id, @batches.map { |c| [c.full_name, c.id] },
        {:prompt => "#{t('select_a_batch')}"},
        {:onChange => "#{remote_function(:url => {:action => "update_fees_collection_dates_voucher"}, :with => "'batch_id='+value")}"}%> </div>

用于onChange操作..我想将散列键(c.fullname)传递给远程update_fees_collection_dates_voucher控制器而不是散列值(c.id)。用''替换“'batch_id ='+ value” batch_id ='+ key“似乎不起作用。有任何想法吗?谢谢!

1 个答案:

答案 0 :(得分:0)

这不起作用吗?

{:onChange => "#{remote_function(:url => {:action => "update_fees_collection_dates_voucher"}, :with => "'batch_id='+ $(this).html()}"}%>