* 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
27 lines
503 B
Ruby
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
|