Skip to content

Instantly share code, notes, and snippets.

View leemcalilly's full-sized avatar

Lee McAlilly leemcalilly

View GitHub Profile
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 },
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
def filename
"#{@original_filename}".underscore
end
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
# encoding: utf-8
class TrackUploader < CarrierWave::Uploader::Base
include Sprockets::Helpers::RailsHelper
include Sprockets::Helpers::IsolatedHelper
include CarrierWaveDirect::Uploader
# Recommended for use with fog
# encoding: utf-8
class TrackUploader < CarrierWave::Uploader::Base
include Sprockets::Helpers::RailsHelper
include Sprockets::Helpers::IsolatedHelper
include CarrierWaveDirect::Uploader
# Recommended for use with fog
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
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
@leemcalilly
leemcalilly / gist:5025723
Created February 24, 2013 21:29
uploaders/track_uploader.rb
# encoding: utf-8
class TrackUploader < CarrierWave::Uploader::Base
include Sprockets::Helpers::RailsHelper
include Sprockets::Helpers::IsolatedHelper
include CarrierWaveDirect::Uploader
# Recommended for use with fog
def filename
"#{filename}".underscore
end