Created
October 9, 2012 00:32
-
-
Save jordanthomas/3855828 to your computer and use it in GitHub Desktop.
nested resource errors
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
class InvitesController < ApplicationController | |
def create | |
@project = Project.find(params[:project_id]) | |
@invite = @project.invites.build(params[:invite]) | |
if @project.save | |
redirect_to project_url(@project), :notice => 'Success message.' | |
else | |
render # ?? project/show ?? | |
end | |
end | |
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
<!-- Details of @project rendered up here --> | |
<!-- Render errors for failed @invite here --> | |
<%= form_for([@project, @invite]) do |f| %> | |
<p> | |
<%= f.label :email %><br> | |
<%= f.text_field :email %> | |
</p> | |
<p> | |
<%= f.submit %> | |
</p> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment