Skip to content

Instantly share code, notes, and snippets.

@JeffHoover
Created February 20, 2011 20:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save JeffHoover/836250 to your computer and use it in GitHub Desktop.
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