Created
June 12, 2013 03:40
-
-
Save anonymous/5762672 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def edit_measurements | |
@estimate = Estimate.find(params[:id]) | |
@measurements = @estimate.measurements | |
end | |
def update_measurements | |
#Find object using form parameters | |
@estimate = Estimate.find(params[:id]) | |
#Update subject | |
if @estimate.update_attributes(params[:estimate]) | |
#if save succeeds, redirect to list action | |
redirect_to(:action => 'list_current') | |
else | |
#if save fails, redisplay form to user can fix problems | |
render('edit') | |
end | |
end |
This file contains hidden or 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
<div> | |
<h2>Measurements For: <%= @estimate.project.name %></h2> | |
<%= form_for @estimate, :url => {:action => 'update_measurements', :id => @estimate.id} do |f| %> | |
<table summary="Lead detail view"> | |
<%= f.fields_for :measurements do |m| %> | |
<tr> | |
<th><%= m.text_field(:name) %></th> | |
<td><%= m.text_field(:amount) %> | |
</tr> | |
<% end %> | |
</table> | |
<%= f.submit "Submit" %> | |
<% end %> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment