开发者

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}"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜