I am using a form partial for updating and creating my users.
Like:
<%= form_for @user do |f| %>
Now rails automatically assigns the method post if the form corresponds
with a nonexistent user and the patch method if the user exists and just
needs to be updated.
My problem is that the update form and the new user form are supposed to
be slightly different, therefore I would like to write code like
if form.method.patch?
...do something
else
.... do something else
end
Is there a way to accomplish this?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2ab0da5c9a2de793e69b5c715599f0a7%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment