Created
February 13, 2009 04:29
-
-
Save batasrki/63047 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 create | |
| @album = Album.new(params[:album]) | |
| if @album.save | |
| @photo = Photo.new(params[:photo]) | |
| @photo.album = @album | |
| @photo.save | |
| 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
| ## app/views/albums/new.html.erb | |
| ## (This is only sample code and will probably not work for you out of the box) | |
| <% form_for @album do |f| %> | |
| <%= f.text_field :name %> | |
| <%= f.file_field [:photo][:file_name] %> # Suggest you look into Paperclip for uploading files | |
| <% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment