Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
form partial for new and edit
# app/views/shared/_form.html.erb:
<%= form_for(@user, button_text) do |f| %>
<%= render 'fields', :f => f %>
<div class="actions">
<%= f.submit button_text %>
</div>
<% end %>
# Now works when called from new.html.erb with either:
<%= render 'shared/form', :locals =>{:button_text => "Sign Up!"} %>
#or
<%= render 'shared/form', :button_text => "Sign Up!" %>
#(same for edit.html.erb, with a different button_text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment