Ruby on rails 尝试调用搜索操作的创建操作的Rails链接到

Ruby on rails 尝试调用搜索操作的创建操作的Rails链接到,ruby-on-rails,Ruby On Rails,我在我的Rails应用程序中有一个链接,该链接用于向旅行添加用户。链接本身是这样的: <%= link_to "Add to trip", {:url => trip_users_url(@trip.id, {:user_id => user.id}), :remote => true, :method => :post}, :class => 'button absolute' %> 它传递的参数是: {"method"=>"post", "

我在我的Rails应用程序中有一个链接,该链接用于向旅行添加用户。链接本身是这样的:

<%= link_to "Add to trip", {:url => trip_users_url(@trip.id, {:user_id => user.id}), :remote => true, :method => :post}, :class => 'button absolute' %>
它传递的参数是:

{"method"=>"post",
 "remote"=>"true",
 "url"=>"http://localhost:3000/trips/18/users?user_id=11",
 "trip_id"=>"18-Testing"}
因此,它清楚地知道行程,以及所需的用户id

有什么想法吗

**编辑**

以下是路线的相关部分:

map.resources :trips, :member => {:share => :get, :map => :get, :favourite => [:post, :get]}, :collection => {:find_boat => :get} do |trips|
    trips.resources :photos
    trips.resources :videos
    trips.resources :users, :controller => "trips_users", :collection => {:search => [:get, :post]}
    trips.resources :paths
    trips.resources :posts
    trips.resources :invitations
  end

能否在路由文件中提供相关行?请尝试user.id},remote:true,method::post,class:'按钮绝对'>。我不确定这是否能解决问题,但对第二个参数使用哈希通常只有在使用{controller:'Foo',action:'bar'}时才能完成。正如papirtiger所说,ruby会将该哈希视为url的额外参数,这就是为什么您将方法、远程和url视为参数的原因。我已经尝试过了,它消除了错误,但实际上仍然没有将用户添加到旅行中,它所做的只是将页面重定向回一个…链接指向什么URL?此外,在您的服务器控制台中,单击“ex.Started GET/for…”链接时发生的每个请求的前两行是什么。。。WelcomeControllerindex是否以HTML格式处理?
{"method"=>"post",
 "remote"=>"true",
 "url"=>"http://localhost:3000/trips/18/users?user_id=11",
 "trip_id"=>"18-Testing"}
map.resources :trips, :member => {:share => :get, :map => :get, :favourite => [:post, :get]}, :collection => {:find_boat => :get} do |trips|
    trips.resources :photos
    trips.resources :videos
    trips.resources :users, :controller => "trips_users", :collection => {:search => [:get, :post]}
    trips.resources :paths
    trips.resources :posts
    trips.resources :invitations
  end