This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
rolify | |
authenticates_with_sorcery! | |
attr_accessible :email, :password, :password_confirmation | |
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i | |
validates :email, :presence => true, | |
:format => { :with => email_regex }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installing activesupport (4.0.0.beta1) | |
Gem::InstallError: activesupport requires Ruby version >= 1.9.3. | |
An error occurred while installing activesupport (4.0.0.beta1), and Bundler | |
cannot continue. | |
Make sure that `gem install activesupport -v '4.0.0.beta1'` succeeds before | |
bundling. | |
! | |
! Failed to install gems via Bundler. | |
! | |
! Heroku push rejected, failed to compile Ruby/rails app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def filename | |
"#{@original_filename}".underscore | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SongsController < ApplicationController | |
# GET /songs | |
def index | |
@songs = Song.all | |
@uploader = Song.new.track | |
@uploader.success_action_redirect = new_song_url | |
end | |
# GET /songs/1 | |
def show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
class TrackUploader < CarrierWave::Uploader::Base | |
include Sprockets::Helpers::RailsHelper | |
include Sprockets::Helpers::IsolatedHelper | |
include CarrierWaveDirect::Uploader | |
# Recommended for use with fog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
class TrackUploader < CarrierWave::Uploader::Base | |
include Sprockets::Helpers::RailsHelper | |
include Sprockets::Helpers::IsolatedHelper | |
include CarrierWaveDirect::Uploader | |
# Recommended for use with fog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SongsController < ApplicationController | |
# GET /songs | |
def index | |
@songs = Song.all | |
@uploader = Song.new.track | |
@uploader.success_action_redirect = new_song_url | |
end | |
# GET /songs/1 | |
def show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Song < ActiveRecord::Base | |
attr_accessible :artist, :artwork, :category, :credits, :title, :track, :year | |
belongs_to :user | |
validates_presence_of :user_id | |
validates_presence_of :title | |
mount_uploader :track, TrackUploader | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
class TrackUploader < CarrierWave::Uploader::Base | |
include Sprockets::Helpers::RailsHelper | |
include Sprockets::Helpers::IsolatedHelper | |
include CarrierWaveDirect::Uploader | |
# Recommended for use with fog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def filename | |
"#{filename}".underscore | |
end |