Update track length in db if empty. Closes #107

This commit is contained in:
Gregory Eremin
2011-10-12 13:24:07 +04:00
parent 20ee424e7f
commit 0ec0b14172
12 changed files with 47 additions and 236 deletions
+18
View File
@@ -0,0 +1,18 @@
class TrackController < ApplicationController
before_filter :authorize
def update_length
unless params[:track_id].nil?
track = Track.find(params[:track_id])
unless track.nil? or params[:length].nil?
if track.length == nil or track.length.to_i == 0 and params[:length].to_i > 0
track.length = params[:length].to_i
track.save
render :json => { :result => :success }
return
end
end
end
render :json => { :result => :failed }
end
end