Skip to content

Instantly share code, notes, and snippets.

View adamgamble's full-sized avatar

Adam Gamble adamgamble

View GitHub Profile
### Keybase proof
I hereby claim:
* I am adamgamble on github.
* I am adamgamble (https://keybase.io/adamgamble) on keybase.
* I have a public key whose fingerprint is 1835 03FE D359 3992 236E 4504 D34C 0F36 49E0 FEB2
To claim this, I am signing this object:
01/01/04
#########
some notes
02/02/04
##########
more notes

Keybase proof

I hereby claim:

  • I am adamgamble on github.
  • I am adamgamble (https://keybase.io/adamgamble) on keybase.
  • I have a public key whose fingerprint is 803B BDE1 0706 E85B 3941 9EF8 31EE C9D3 5026 8305

To claim this, I am signing this object:

$10 iTunes Gift Card
product = Spree::Product.find 11666
variant = Spree::Variant.where(:product_id => product.id).first
line_items = Spree::LineItem.where(:variant_id => 11622).pluck(&:id)
RewardDelivery.where(:reward_id => line_items)
$5 Claire's Gift Card
product = Spree::Product.find 11689
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'rails/test_help'
class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module Blog
class Application < Rails::Application
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module Blog
class Application < Rails::Application
class ArticlesController < ApplicationController
before_action :authenticate, except: [:index, :show]
before_action :set_article, only: [:show]
# GET /articles
# GET /articles.json
def index
@articles = Article.all
end
class Comment < ActiveRecord::Base
belongs_to :article
validates_presence_of :name, :email, :body
validate :article_should_be_published
after_create :email_article_author
after_create :send_comment_email
def article_should_be_published
Blog::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# DO not eager load code on boot.
config.eager_load = false