i know i'm breaking rails convention somehow causing error, can't figure out what...
# controller def membership @user = user.new(user_type:"member") end def membership_create @user = user.find(params[:id]) ... end # routes match '/membership/create.:id', to: "users#membership_create", via: :post, as: "create_member" # view # have tried following based on various other answers, doesn't work <%= form_for @user, :url => create_member_path(@user), method: :post |f| %> <%= form_for @user, :url => create_member_path(@user) |f| %>
consistently getting error message: no route matches {:action=>"membership_create", :controller=>"users", :id=>nil} missing required keys: [:id]
why not /membership/create/:id
opposed /membership/create.:id
?
but then, building new user membership method:
def membership @user = user.new(user_type:"member") end
and user has no id
yet. so, when passing path form:
<%= form_for @user, :url => create_member_path(@user) |f| %>
the id
nil
.
however, membership_create
requires id
? - ( configured in route ) remember nil @ point. unless have miraculously included id
somewhere in loop, can't see, or 2 methods not directly related think.
Comments
Post a Comment