Ruby on Rails: How do I pass variables with observer_form?
I have
<%= observe_field :tb_search,
:frequency=>0.5, :update=>'reports',
:url=>{
:action=>'filter_reports',
开发者_如何学Go :only_path=>false,
:user=>@user.id},
:with=>"'search='+encodeURIComponent(value)" %>
but on the controller side, params[:user] is nil. I did a
puts "NTHDEONUTHDOEDEUU#{params[:user].nil?}||"
in the responding method in controller to prove to myself that it was nil.
any ideas?
With this helper I believe you need to pass all params through the :with
option. Something like:
<%= observe_field :tb_search,
:frequency=>0.5, :update=>'reports',
:url=>{
:action=>'filter_reports',
:only_path=>false},
:with=>"'search='+encodeURIComponent(value)+'&user='#{@user.id}"
精彩评论