A Pen by Jorge Téllez on CodePen.
This file contains hidden or 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 Pony | |
attr_accessor :hungry | |
def initialize | |
@hungry = true | |
end | |
def legs | |
4 | |
end |
This file contains hidden or 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
source 'https://rubygems.org' | |
gem 'rails', '4.2.4' | |
gem 'sqlite3' | |
gem 'sass-rails', '~> 5.0' | |
gem 'uglifier', '>= 1.3.0' | |
gem 'coffee-rails', '~> 4.1.0' | |
gem 'jquery-rails' | |
gem 'turbolinks' | |
gem 'jbuilder', '~> 2.0' |
This file contains hidden or 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 ItemSerializer < ActiveModel::Serializer | |
attributes :id, | |
:name, | |
:description, | |
:image_url, | |
:created_at, | |
:updated_at, | |
:order_count | |
has_many :order_items |
This file contains hidden or 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 Api::V1::ItemsController < ApplicationController | |
respond_to :json, :xml | |
before_action :authenticate! | |
def index | |
respond_with Item.all | |
end | |
def show |
This file contains hidden or 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
ENV['RAILS_ENV'] ||= 'test' | |
require File.expand_path('../../config/environment', __FILE__) | |
require 'rails/test_help' | |
require 'minitest/pride' | |
require 'webmock' | |
require 'vcr' | |
class ActiveSupport::TestCase | |
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. | |
fixtures :all |
This file contains hidden or 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 Commitee < OpenStruct | |
attr_reader :service | |
def self.service | |
@service ||= SunlightService.new | |
end | |
def self.find_by(params) | |
service.committees(params).map { |commitee| Commitee.new(commitee) } | |
end |
This file contains hidden or 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
module Emailery | |
class Application < Rails::Application | |
config.action_mailer.delivery_method = :smtp | |
config.action_mailer.smtp_settings = { | |
address: 'smtp.mandrillapp.com', | |
port: 587, | |
domain: 'example.com', | |
user_name: '[email protected]', | |
password: 'ZNrasQmPJPybqX_gsihNdQ', | |
authentication: 'plain', |
This file contains hidden or 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 Seed | |
def self.start | |
seed = Seed.new | |
seed.generate_users | |
seed.generate_items | |
seed.generate_orders | |
end | |
def generate_users | |
50.times do |i| |
This file contains hidden or 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
module And | |
class Double | |
attr_accessor :input_a, | |
:input_b | |
def initialize | |
@input_a = 0 | |
@input_b = 0 | |
end |