I’m currently working on a Rails project right now, doing learning and working on it at the same time…
So I was just trying to create a form for editing user and this is how I doing it
<%= form_for(@user,:url => { :action => "update",:controller => "users" }) do |f| %>
<% @f = f %>
<%= render 'users/dialog'%>
<% end %>
But then I got the error
No route matches {:action=>"update", :controller=>"users"}
Which I did not expect it to be happen since
<%= form_for(@user,:url => { :action => "create",:controller => "users" }) do |f| %>
is working for me.
Didn’t find some answer I want on Google, hope someone can help me out on this
Thanks
No need to supply a
:urlif you already pass the @user object.Also, avoid setting variables such as
@fin the view. This is not view’s responsibility.