Created
March 31, 2009 02:29
-
-
Save seivan/88015 to your computer and use it in GitHub Desktop.
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
<h1>New post</h1> | |
<% @post.photos.build if @post.photos.empty? %> | |
<% form_for(@post) do |f| %> | |
<%= f.error_messages %> | |
<p> | |
<%= f.label :name %><br /> | |
<%= f.text_field :name %> | |
</p> | |
<p> | |
<%= f.label :content %><br /> | |
<%= f.text_area :content %> | |
</p> | |
<!-- :photos is a model that has paperclip on it. | |
I can use :image with the photomodel and it's action, but when trying to do a nested form | |
everything in Post.photos is nil except the timestamp --> | |
<% f.fields_for :photos, :html => { :multipart => true } do |picture| %> | |
<%= picture.label :image %> | |
<%= picture.file_field :image %> | |
<% end %> | |
<p> | |
<%= f.submit 'Create' %> | |
</p> | |
<% end %> | |
<%= link_to 'Back', posts_path %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment