diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index ec61d0d..cb7381c 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -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 diff --git a/app/views/albums/_form.html.erb b/app/views/albums/_form.html.erb index 8d31bd2..401cc15 100644 --- a/app/views/albums/_form.html.erb +++ b/app/views/albums/_form.html.erb @@ -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'} %>
<%= form.text_field :title, {:class => 'big'} %>
+ <%= form.label :description %>
<%= form.text_area :description %>