save new album to current collection

rails2
Espen Antonsen 2009-06-30 22:41:27 +02:00
parent 0fb47748db
commit 07493aaaad
2 changed files with 5 additions and 0 deletions

View File

@ -45,6 +45,9 @@ class AlbumsController < ApplicationController
@album = Album.new(params[:album])
@album.path = @album.title
if @album.save
if params[:collection_id]
@album.collections << Collection.find( params[:collection_id] )
end
flash[:notice] = "Album created!"
redirect_to @album
else

View File

@ -3,9 +3,11 @@
<% end %>
<%= hidden_field_tag :all_tags, "'#{Tag.find(:all).map { |tag| tag.title }.join('\',\'')}'" %>
<%= hidden_field_tag :collection_id, params[:collection_id] %>
<%= form.label :title, :Title, {:class => 'big'} %><br />
<%= form.text_field :title, {:class => 'big'} %><br />
<%= form.label :description %><br />
<%= form.text_area :description %><br />