To become member, A user can use a button to create a membership on the community page. This is made on a partial that create a new “membership”
the memberships_controller :
@community = Community.find(params[:community_id])
@community.memberships.create(:user => current_user, :role => 1)
in The view :
<% form_remote_tag :url => community_memberships_path(@community) do %>
<%= submit_tag 'Join' %>
<% end %>
After upgrading to Rails 3, that doesn’t work anymore !
I tried this :
<% form_tag( {:url => community_memberships_path(@community)}, :remote => true) do %>
and this :
<% form_tag :url => {:controller => '/memberships/new', :action => :create,:community_id => @community }, :remote => true do %>
But no chance.. and have this error
No route matches “/communities/2
Thx for help
The URL is the first argument, options are secondary.
As for your
No route matchesexception, check you have translated you routes to the Rails 3 syntax correctly.