Save track files in new Sound model:

* Consolidate migrations
* Add Sound model. Each sound can belong to a track and contains
  informations about one sound file.
This commit is contained in:
Thibault Jouan
2011-09-15 21:08:24 +00:00
parent f49a5a3f67
commit 27550fd14e
26 changed files with 265 additions and 216 deletions

View File

@@ -0,0 +1,6 @@
class SoundsController < ApplicationController
def show
sound = Sound.find params[:id]
send_file sound.path, :type => sound.mime_type
end
end

View File

@@ -8,19 +8,11 @@ class TracksController < ApplicationController
end
def create
@track = Track.new(:name => params[:track][:name])
if @track.save_with_file(
params[:track][:file],
params[:track][:file].content_type
)
@track = Track.new params[:track]
if @track.save
redirect_to @track
else
render :new
end
end
def download
track = Track.find params[:id]
send_file track.filepath, :type => track.mime_type
end
end