Files
scube-server/app/controllers/tracks_controller.rb
Thibault Jouan f49a5a3f67 Update to rails 3.1.0
* Bump rails version to 3.1.0 in Gemfile
* Update config files
* Fix bcrypt monkey patch for specs
* Fix TracksController
* Replace track streaming with track download
* Remove assets from application layout
2011-09-15 16:10:21 +00:00

27 lines
503 B
Ruby

class TracksController < ApplicationController
def show
@track = Track.find params[:id]
end
def new
@track = Track.new
end
def create
@track = Track.new(:name => params[:track][:name])
if @track.save_with_file(
params[:track][:file],
params[:track][:file].content_type
)
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