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 ArtistsController < ApplicationController | |
before_action :set_artist, only: [:show, :edit, :update, :destroy] | |
skip_before_action :require_login, only: [:index, :show] | |
def index | |
@artists = Artist.all | |
end | |
def show | |
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 QuotesController < ApplicationController | |
before_action :set_quote, only: [:show] | |
before_action :require_login | |
skip_before_action :require_login, only: [:index, :show] | |
def show | |
end | |
def new |
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 QuotesController < ApplicationController | |
before_action :set_quote, only: [:show] | |
before_action :require_login | |
skip_before_action :require_login, only: [:index, :show] | |
def show | |
end | |
def new |
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 Artist < ApplicationRecord | |
belongs_to :user | |
has_many :spoken_quotes, class_name: "Quote", foreign_key: :speaker_id | |
has_many :topic_quotes, class_name: "Quote", foreign_key: :topic_id | |
validates :user_id, presence: true | |
validates :name, presence: true, length: { maximum: 120 }, | |
uniqueness: { case_sensitive: false } | |
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
<%= form_for(@quote) do |f| %> | |
<%= render 'shared/error_messages', object: f.object %> | |
<div class='row'> | |
<div class='col'> | |
<div class='form-group'> | |
<%= f.label :speaker, 'Who said it?' %> | |
<%= f.collection_select :speaker_id, Artist.order(:name), :id, :name, | |
{prompt: 'Select an artist'}, {class: 'form-control select-artist'} %> | |
</div> |
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 Quote < ApplicationRecord | |
belongs_to :user | |
belongs_to :speaker, class_name: "Artist" | |
belongs_to :topic, class_name: "Artist" | |
belongs_to :genre | |
delegate :medium, to: :genre, allow_nil: true | |
accepts_nested_attributes_for :speaker |
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
'use strict'; | |
// # Globbing | |
// for performance reasons we're only matching one level down: | |
// 'test/spec/{,*/}*.js' | |
// use this if you want to match all subfolders: | |
// 'test/spec/**/*.js' | |
module.exports = function (grunt) { | |
// load all grunt tasks |
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
haml: { | |
files: ['<%= yeoman.app %>/{layout,snippets,templates,templates/customers}/*.haml'], | |
tasks: ['haml'] | |
}, | |
update: { | |
files: ['<%= yeoman.app %>/{layout,snippets,templates,templates/customers}/*.liquid'], | |
tasks: ['copy'] | |
}, |
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
$('#Helium').on('ready', function(e){ | |
console.log('ready'); | |
$('#Helium').on('add-to-cart', function(e, sku){ | |
console.log('added '+ sku + ' to cart'); | |
_gaq.push(["_trackEvent", "Helium Cart", "Add To Cart", "Peruvian Strap", "Dick Dale"]); | |
}); | |
}); |
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
FactoryGirl.define do | |
factory :user do | |
sequence(:email) { |n| "person_#{n}@example.com"} | |
password "secret" | |
password_confirmation "secret" | |
factory :admin do | |
after(:create) {|user| user.add_role(:admin)} | |
end | |
end |