18 lines
524 B
Ruby
18 lines
524 B
Ruby
|
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
|