Use ruby 2.x hash syntax
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class API::ApplicationController < ApplicationController
|
||||
skip_before_filter :verify_authenticity_token
|
||||
skip_before_filter :authenticate!, :only => [:cor_preflight]
|
||||
skip_before_filter :authenticate!, only: [:cor_preflight]
|
||||
|
||||
before_filter :cor_filter
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
class API::SessionsController < API::ApplicationController
|
||||
skip_before_filter :authenticate!, :only => [:create]
|
||||
skip_before_filter :authenticate!, only: [:create]
|
||||
|
||||
def create
|
||||
user = User.find_by_email(params[:session][:email])
|
||||
|
||||
if ! user.try(:authenticate?, params[:session][:password])
|
||||
return render :json => '', :status => :not_found
|
||||
return render json: '', status: :not_found
|
||||
end
|
||||
|
||||
@user = user
|
||||
|
@@ -2,6 +2,6 @@ class API::SoundsController < API::ApplicationController
|
||||
# FIXME: add some tests!
|
||||
def show
|
||||
sound = Sound.find params[:id]
|
||||
send_file sound.path, :type => sound.mime_type
|
||||
send_file sound.path, type: sound.mime_type
|
||||
end
|
||||
end
|
||||
|
@@ -10,9 +10,9 @@ class PlaylistsController < ApplicationController
|
||||
def create
|
||||
@playlist = current_user.playlists.build(params[:playlist])
|
||||
if @playlist.save
|
||||
redirect_to :action => 'index'
|
||||
redirect_to action: 'index'
|
||||
else
|
||||
render :action => 'new'
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,9 +23,9 @@ class PlaylistsController < ApplicationController
|
||||
def update
|
||||
@playlist = Playlist.find(params[:id])
|
||||
if @playlist.update_attributes params[:playlist]
|
||||
redirect_to :action => 'index'
|
||||
redirect_to action: 'index'
|
||||
else
|
||||
render :action => 'edit'
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -1,5 +1,5 @@
|
||||
class SessionsController < ApplicationController
|
||||
skip_before_filter :authenticate!, :only => [:new, :create]
|
||||
skip_before_filter :authenticate!, only: [:new, :create]
|
||||
|
||||
def create
|
||||
user = User.find_by_email(params[:session][:email])
|
||||
|
@@ -1,6 +1,6 @@
|
||||
class SoundsController < ApplicationController
|
||||
def show
|
||||
sound = Sound.find params[:id]
|
||||
send_file sound.path, :type => sound.mime_type
|
||||
send_file sound.path, type: sound.mime_type
|
||||
end
|
||||
end
|
||||
|
@@ -1,5 +1,5 @@
|
||||
class UsersController < ApplicationController
|
||||
skip_before_filter :authenticate!, :only => [:new, :create]
|
||||
skip_before_filter :authenticate!, only: [:new, :create]
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
|
@@ -6,7 +6,7 @@ class Track < ActiveRecord::Base
|
||||
validates_presence_of :name
|
||||
|
||||
def file=(file)
|
||||
sounds.build({:file => file})
|
||||
sounds.build(file: file)
|
||||
end
|
||||
|
||||
def sound
|
||||
|
@@ -9,11 +9,11 @@ class User < ActiveRecord::Base
|
||||
has_many :playlists
|
||||
|
||||
validates :email,
|
||||
:presence => true,
|
||||
:uniqueness => true
|
||||
presence: true,
|
||||
uniqueness: true
|
||||
validates :password,
|
||||
:presence => true,
|
||||
:confirmation => true
|
||||
presence: true,
|
||||
confirmation: true
|
||||
validates_presence_of :password_hash
|
||||
|
||||
def password=(plain_password)
|
||||
|
@@ -3,4 +3,4 @@ collection @tracks
|
||||
attribute :id
|
||||
attribute :name
|
||||
|
||||
node(:sound_url, :if => ->(t) { t.sound? }) { |t| api_sound_url t.sound }
|
||||
node(:sound_url, if: ->(t) { t.sound? }) { |t| api_sound_url t.sound }
|
||||
|
@@ -1,7 +1,7 @@
|
||||
!!!
|
||||
%html
|
||||
%head
|
||||
%meta{:charset => 'utf-8'}
|
||||
%meta{charset: 'utf-8'}
|
||||
%title scube
|
||||
= csrf_meta_tag
|
||||
%body
|
||||
|
@@ -1 +1 @@
|
||||
= render 'form', :submit_text => 'Save'
|
||||
= render 'form', submit_text: 'Save'
|
||||
|
@@ -1 +1 @@
|
||||
= render 'form', :submit_text => 'Create'
|
||||
= render 'form', submit_text: 'Create'
|
||||
|
@@ -1,4 +1,4 @@
|
||||
= form_for(:session, :url => sessions_path) do |f|
|
||||
= form_for(:session, url: sessions_path) do |f|
|
||||
%table
|
||||
%tbody
|
||||
%tr
|
||||
|
@@ -1,4 +1,4 @@
|
||||
= form_for @track, :html => { :multipart => true } do |t|
|
||||
= form_for @track, html: { multipart: true } do |t|
|
||||
%table
|
||||
%tbody
|
||||
%tr
|
||||
|
@@ -1,5 +1,5 @@
|
||||
%h1= @track.name
|
||||
|
||||
- if @track.sound?
|
||||
%audio{:src => sound_path(@track.sound), :controls => true, :autoplay => true}
|
||||
%audio{src: sound_path(@track.sound), controls: true, autoplay: true}
|
||||
Your browser does not support the audio element
|
||||
|
@@ -1,4 +1,4 @@
|
||||
= form_for(@user, :url => users_path) do |f|
|
||||
= form_for(@user, url: users_path) do |f|
|
||||
- if @user.errors.any?
|
||||
%ul
|
||||
- @user.errors.full_messages.each do |m|
|
||||
|
Reference in New Issue
Block a user