Fix coding standards in application
This commit is contained in:
parent
aca19eb51f
commit
e6f6475705
@ -1,4 +1,5 @@
|
||||
class API::ApplicationController < ApplicationController
|
||||
module API
|
||||
class ApplicationController < ::ApplicationController
|
||||
skip_before_filter :verify_authenticity_token
|
||||
skip_before_filter :authenticate!, only: [:cor_preflight]
|
||||
|
||||
@ -24,3 +25,4 @@ class API::ApplicationController < ApplicationController
|
||||
head :unauthorized if current_user.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,5 @@
|
||||
class API::PlaylistsController < API::ApplicationController
|
||||
module API
|
||||
class PlaylistsController < ApplicationController
|
||||
respond_to :json
|
||||
|
||||
def index
|
||||
@ -10,3 +11,4 @@ class API::PlaylistsController < API::ApplicationController
|
||||
@playlist.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,11 @@
|
||||
class API::SessionsController < API::ApplicationController
|
||||
module API
|
||||
class SessionsController < ApplicationController
|
||||
skip_before_filter :authenticate!, only: [:create]
|
||||
|
||||
def create
|
||||
user = User.find_by_email(params[:session][:email])
|
||||
|
||||
if !user.try(:authenticate?, params[:session][:password])
|
||||
unless user.try(:authenticate?, params[:session][:password])
|
||||
return render json: '', status: :not_found
|
||||
end
|
||||
|
||||
@ -12,3 +13,4 @@ class API::SessionsController < API::ApplicationController
|
||||
self.current_user = @user
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,9 @@
|
||||
class API::SoundsController < API::ApplicationController
|
||||
module API
|
||||
class SoundsController < ApplicationController
|
||||
# FIXME: add some tests!
|
||||
def show
|
||||
sound = Sound.find params[:id]
|
||||
send_file sound.path, type: sound.mime_type
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,7 @@
|
||||
class API::TracksController < API::ApplicationController
|
||||
module API
|
||||
class TracksController < ApplicationController
|
||||
def index
|
||||
@tracks = Track.all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user