save new album to current collection
This commit is contained in:
parent
0fb47748db
commit
07493aaaad
|
@ -45,6 +45,9 @@ class AlbumsController < ApplicationController
|
||||||
@album = Album.new(params[:album])
|
@album = Album.new(params[:album])
|
||||||
@album.path = @album.title
|
@album.path = @album.title
|
||||||
if @album.save
|
if @album.save
|
||||||
|
if params[:collection_id]
|
||||||
|
@album.collections << Collection.find( params[:collection_id] )
|
||||||
|
end
|
||||||
flash[:notice] = "Album created!"
|
flash[:notice] = "Album created!"
|
||||||
redirect_to @album
|
redirect_to @album
|
||||||
else
|
else
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= hidden_field_tag :all_tags, "'#{Tag.find(:all).map { |tag| tag.title }.join('\',\'')}'" %>
|
<%= 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.label :title, :Title, {:class => 'big'} %><br />
|
||||||
<%= form.text_field :title, {:class => 'big'} %><br />
|
<%= form.text_field :title, {:class => 'big'} %><br />
|
||||||
|
|
||||||
<%= form.label :description %><br />
|
<%= form.label :description %><br />
|
||||||
<%= form.text_area :description %><br />
|
<%= form.text_area :description %><br />
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue