Created
February 20, 2011 20:08
-
-
Save JeffHoover/836250 to your computer and use it in GitHub Desktop.
form partial for new and edit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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