text
stringlengths
10
2.61M
class WalksController < ApplicationController def index @walk = Walk.all end def show @walk = Walk.find(params[:id]) end def new @walk = Walk.new end def create @walk = Walk.new(walk_params) if @walk.save #do something #flash[:success] = "Your account has been c...
class FutureValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if value < Date.today record.errors.add(attribute, "has already passed") end end end
class ChangeForkedFromToInteger < ActiveRecord::Migration def change change_column :documents, :forked_from, :integer end end
class Form < ApplicationRecord has_many :questions, dependent: :destroy def get_questions_by_step(current_step = 1) return self.questions.where(["step = :step", {step: current_step}]) end end
# Case clicable par le joueur # @attr CSS_BOUTON_ROUGE [CssProvider] VARIABLE DE CLASSE : code CSS d'un bouton rouge # @attr CSS_BOUTON_GRIS [CssProvider] VARIABLE DE CLASSE : code CSS d'un bouton gris # @attr etat [Etat] état de la case class CaseClic < Case attr_accessor :etat @@CSS_BOUTON_ROUGE ||= Gtk::Cs...
class WorksController < ApplicationController def create start_time = Time.zone.now.strftime('%Y-%m-%d %H:%M:%S') @work = Work.new(user_id: work_params[:user_id], status: work_params[:status], start_time: start_time) if @work.save render json: { msg: "#{@work.user.name}さん、がんばりましょ!", work: @work } ...
require 'csv' module ContactsController extend Sinatra::Extension get '/contacts', provides: :json do return 403 unless @current_user Contact.where(user_id: @current_user.id) .to_json(only: %i[id first_name last_name tags phone_number unseen_messages_count unrespons...
class User < ApplicationRecord has_and_belongs_to_many :pages has_many :section_edits has_many :sections, through: :section_edits scope :sample, -> {offset(rand(User.count)).first} end
class Picture < Attachment include ImageUploader[:file] %w(original medium small mini).each do |version| self.class_eval <<-RUBY, __FILE__, __LINE__ def #{version}_url file[:#{version}].url end RUBY end def original_filename file[:original].original_filename end end
class AddMentionsToCommentsAndMessages < ActiveRecord::Migration def change add_column :tr8n_translation_key_comments, :mentions, :string add_column :tr8n_forum_messages, :mentions, :string end end
# frozen_string_literal: true module GraphQL class Schema class Wrapper include GraphQL::Schema::Member::TypeSystemHelpers # @return [Class, Module] The inner type of this wrapping type, the type of which one or more objects may be present. attr_reader :of_type def initialize(of_type) ...
require 'spec_helper' describe 'Login' do before(:each) do @user = FactoryGirl.build(:user) OmniAuth.config.mock_auth[:ufc] = OmniAuth::AuthHash.new({ provider: @user.provider, uid: @user.uid, info: { email: @user.email, first_name: @user.first_name, last_name: @use...
ActiveAdmin.register Project do permit_params :name, :email, :location_id show do attributes_table do row :id row :name row :email row :location end table_for project.assets do column :serial_number column :bar_code column :asset_type end end end
require 'spec_helper_min' require 'factories/carto_visualizations' describe Carto::UserMetadataExportService do include NamedMapsHelper include Carto::Factories::Visualizations before(:all) do bypass_named_maps @feature_flag = FactoryGirl.create(:carto_feature_flag) end after(:all) do @feature_...
module LayoutHelper def link_to_shopping_cart return "" if current_spree_page?(cart_path) if current_order.nil? or current_order.line_items.empty? text = "Cart: (0)" css_class = 'empty' else text = "Cart: (#{current_order.item_count}) <span class='amount'>#{order_subtotal(current_o...
require 'pry' class CashRegister attr_accessor :total, :discount, :cart, :previous_price def initialize(discount = nil) @total = 0 @discount = discount @cart = [] end def add_item(title, price, quantity = 1) @previous_price = @total i = 0 while i < quantity do @cart << title ...
module ScaffoldMarkup module Builders class PageBuilder < BaseBuilder include Helpers::LinkButtonHelper include Helpers::TableHelper def to_s html = template.capture(self, &block) flash_messages html end def container(attributes={}, &block) #TODO: Co...
require 'garage' describe Garage do it 'Store bikes from van' do expect(subject.store_from_van([1, 2, 3])).to eq([1, 2, 3]) end it 'Fixes all bikes' do bike1, bike2 = Bike.new, Bike.new bike1.report_broken bike2.report_broken arr = [bike1, bike2] subject.store_from_van(arr) expect(su...
shared_examples 'timezone' do describe file '/etc/localtime' do it { should be_linked_to '/usr/share/zoneinfo/Asia/Tokyo' } end describe command 'date' do its(:stdout) { should include ' JST' } end end
class AccountableAddAccountColumnsToUsersTable < ActiveRecord::Migration def up add_column :users, :user_status, :integer, :default => -1 add_column :users, :account_id, :integer end def down remove_column :users, :user_status remove_column :users, :account_id end end
describe Wareki::Kansuji do u = Wareki::Utils it "converts kansuji to integer" do expect(u.k2i("千二百三十四")).to eq 1234 expect(u.k2i("百卄")).to eq 120 expect(u.k2i("一二三四")).to eq 1234 expect(u.k2i("千皕卅肆")).to eq 1234 expect(u.k2i("一〇〇〇五")).to eq 10005 expect(u.k2i("〇")).to eq 0 expect(u.k2i...
class Api::ModeratorController < Api::ApiController before_action :ensure_admin def get_pending_rewards @rewards = Reward.where(moderator_approved: false).page(params[:page]) render 'moderators/reward.json.jbuilder' end def approve_reward reward = Reward.find(params[:id]) reward.update(moderat...
module ActualResults class TestState attr_reader :position attr_reader :outcome attr_accessor :points def initialize(position) @position = position @outcome = :not_tested end def add_test(test) @outcome = test.outcome.intern @points = test.points end def...
require_relative '../bin/cfhighlander' require 'git' require 'pp' require 'octokit' THEONSTACK_COMPONENT_PREFIX = 'hl-component-' THEONSTACK_COMPONENTS = %w( hl-component-vpc hl-component-ecs hl-component-application-loadbalancer hl-component-network-loadbalancer hl-component-eks-cluster hl-component-bastio...
FactoryGirl.define do factory :user, :class => User do sequence :email_address do |seq| "person-#{seq}@mobonotes.com" end password "password" password_confirmation "password" end end
require 'sim_launcher/client' require 'sim_launcher/direct_client' require 'sim_launcher/simulator' require 'sim_launcher/sdk_detector' module SimLauncher DERIVED_DATA = File.expand_path("~/Library/Developer/Xcode/DerivedData") DEFAULT_DERIVED_DATA_INFO = File.expand_path("#{DERIVED_DATA}/*/info.plist") def se...
class ApplicationController < ActionController::Base protect_from_forgery helper_method :liked_posts def liked_posts (session[:liked_posts] ||= {}) end end
class Euler001 require 'pry' def initialize() @range = (1..999) @sum = 0 end def solve @range.each do |i| @sum += (i % 3 === 0 || i % 5 == 0) ? i : 0 end @sum end end
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources :sushis # #index # get '/sushis', to: "sushis#index" # #new # get '/sushis/new', to: "sushis#new", as: "new_sushis" # #create # post '/sushis', to: "sushis#create"...
class Listing < ApplicationRecord validates :title, length: {in: 2..75}, presence: true validates :content, length: {in: 2..2000}, presence: true validates :image, presence: true belongs_to :user has_many :reservations end
class EmptyRequestError < RuntimeError; end class HttpParser require 'rack' attr_reader :raw_request, :first_line CARRIAGE_RETURN = "\r\n".freeze def parse request_socket @raw_request = request_socket @first_line = raw_request.gets || raise(EmptyRequestError) Request.new do |r| r.http_metho...
class GouBrand < ActiveRecord::Base has_many :gous, :dependent => :delete_all upload_column :logo , :versions => {:thumb255=>"c255x255",:thumb90=>"90x90",:thumb16=>"c16x16"} upload_column :banner has_many :articles, :foreign_key => :gou_brand_article_id, :dependent => :delete_all has_one :article, :foreign_k...
class Launch::Component::Card::Header::Image < Launch::Component def html return "" unless content.present? h.image_tag content end end
class Admin::CommentsController < Admin::AdminController before_action :authenticate_user! def destroy @comment = Comment.find (params[:id]) @comment.destroy redirect_to admin_post_path(@comment.post) end end
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.provider :virtualbox do |v| v.name = "centos7.2" v.customize ["modifyvm", :id, "--memory", 1024] end config.vm.synced_folder ".", "/vagrant", mount_options: ['dmode=777','fmode=777'] config.vm.box = "bento/centos-7.2" if...
class ConvertPointsInGroupPlayersToFloat < ActiveRecord::Migration def change change_column :group_players, :points, :float, default: 1000.0 end end
require 'spec_helper' feature 'Admin enters results panel and' do attr_reader :judges, :evaluations, :challenge_with_criteria, :challenge_with_no_criteria, :challenge_with_no_judges, :entries, :evaluation_with_criteria before do # users organization = create :organization admin = create ...
class Describable < ActiveRecord::Base self.abstract_class = true has_many :descriptions, as: :describable has_many :languages, through: :descriptions accepts_nested_attributes_for :descriptions, :allow_destroy => true # validate :one_description validate :one_per_language def description...
class Api::Promotions::DailyCheapController < Api::BaseController skip_before_action :authenticate_user! def index params[:page] ||= 1 params[:per] ||= 6 page = params[:page].to_i per = params[:per].to_i start = (page - 1) * per tail = page * per total = OneMoney.find(type: 'daily_chea...
FactoryGirl.define do factory :task do name "Start new rails project" complete false end end
class FacebookController < ActionController::Base layout 'application' def create user = User.create_facebook_user_from_omniauth(env["omniauth.auth"]) session[:facebook_user_id] = user.id redirect_to root_url end def index if session[:facebook_user_id].nil? redirect_to 'ht...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
class AddChallengeColumns < ActiveRecord::Migration def change add_column :challenges, :delivery_title, :string, null: false, default: '' end end
# frozen_string_literal: true RSpec.describe SyfyfancamDownloader::CLI do let(:downloader) { double('downloader') } let(:parser) { double('parser', personal_hash: 'b') } before do allow(SyfyfancamDownloader::Downloader).to receive(:new) .and_return(downloader) allow(downloader).to receive(:downloa...
class CommentsController < ApplicationController before_action :find_report before_action :find_comment, only: [:edit, :update, :destroy] before_action :authenticate_user! def create @comment = @report.comments.create(comment_params) #associate the comment to the message @comment.user_id = current_user...
class AddPosts < ActiveRecord::Migration def change add_column :posts, :url, :string end end
require_relative '../test_helper' describe RallyOrgApi::Donation do before { @class = RallyOrgApi::Donation } it { @class.must_be_kind_of Class } describe ".new" do it "sets values from input hash" do new_class = @class.new({id: 'bar'}) new_class.instance_variables.must_include(:@id) end e...
class DropColumnsFromQuotes < ActiveRecord::Migration[5.2] def change change_table :quotes do |t| t.remove :date t.remove :location end end end
require File.dirname(__FILE__) + '/../spec_helper' describe DescriptorEspecificosController do describe "handling GET /descriptor_especificos" do before(:each) do @descriptor_especifico = mock_model(DescriptorEspecifico) DescriptorEspecifico.stub!(:find).and_return([@descriptor_especifico]) end ...
class Test < ApplicationRecord belongs_to :request serialize :key serialize :value serialize :actual_value serialize :history scope :failing, -> { where(:status => false) } scope :passing, -> { where(:status => true) } scope :high_priority, -> { where(:priority => Test::HIGH )} scope :low_priority,...
class CreatePortraits < ActiveRecord::Migration def change create_table :portraits do |t| t.string :filename t.string :thumbnail t.string :description t.integer :user_id t.timestamps end add_index :portraits, [:user_id] end end
require 'spec_helper' describe RatingsController do let!(:user) { create(:user, :paul) } let!(:event) { create(:event, :tasafoconf, owner: user) } context 'POST: create' do it 'should not to be nil' do session[:user_id] = user.id params = { rateable_type: 'Event', rateable_id: event.id, ...
require 'shop' describe '#checkout' do it 'returns a total of 50 when basket contains A' do shop = Shop.new expect(shop.checkout('A')).to eq(50) end it 'returns a total of 100 when basket contains AA' do shop = Shop.new expect(shop.checkout('AA')).to eq(100) end it 'returns a total of 30 when bask...
# frozen_string_literal: true class Customer < ApplicationRecord has_one_attached :image validates_presence_of :full_name validates :phone_number, length: { minimum: 10, maximum: 10 }, numericality: { only_integer: true } end
# frozen_string_literal: true # == Schema Information # # Table name: users # # id :uuid not null, primary key # archived :boolean default(FALSE) # archived_at :datetime # mmr :integer # rank :jsonb # battle_tag :string # ...
class SearchResult attr_reader :file_name, :lines def initialize(file_name, lines) @file_name = file_name @lines = lines end def to_s printed_lines = @lines.map do |line| "#{line.line_number}: #{line.text}" end "<#{@file_name}>\n #{printed_lines}" end end
require 'spec_helper' describe EventPostsController do before do mock_geocoding! @event = FactoryGirl.create(:event) @event.save @tailgate = FactoryGirl.create(:tailgate, team_id: @event.home_team.id, official:true ) end def valid_attributes { home_flag: true, visiting_flag: fa...
require 'aws-sdk' require 'securerandom' require_relative 'amazon_credentials/amazon_ami' require_relative 'amazon_credentials/amazon_secrets' class AmazonFacade < InfrastructureFacade def current_state(user) ec2 = get_ec2_for(user) return 'No information available' if ec2.nil? begin ec2_runnin...
# Define require 'pry' #your WIN_COMBINATIONS constant WIN_COMBINATIONS = [[0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [6,4,2] ] # Helper Method def posi...
FactoryGirl.define do factory :area do factory :technology do name "Technology" end end end
# frozen_string_literal: true module TTY class Tree # Render nodes as numbered list class NumberRenderer def initialize(nodes, options = {}) @indent = options.fetch(:indent, 4) @nodes = nodes @mark = ' ' * @indent end def render @nodes.each_with_index.reduce...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
module RiotMongoMapper class HasAssociationAssertion < Riot::AssertionMacro register :has_association def evaluate(model, *association_macro_info) association_name, key_name, options = association_macro_info association = model.associations[key_name.to_sym] association_class = case associat...
module ScaffoldMarkup module Helpers module TableHelper include TwitterBootstrapMarkup def table(collection, attributes, options={}) _self = self column_names = collection.is_a?(ActiveRecord::Relation) ? attributes.map { |a| collection.klass.human_attribute_name(a) } : attributes ...
require 'rails_helper' describe CollectionNorth::Community, type: :model do context 'A community with a title' do let(:community) { FactoryGirl.build(:community) } it 'should have our indexer' do expect(CollectionNorth::Community.indexer).to eq CollectionNorth::CollectionIndexer end it 'shoul...
class ResponsesController < ApplicationController def create @request = Request.find(params[:request_id]) @response = @request.responses.create(response_params) redirect_to request_path(@request) end private def response_params params.require(:response).permit(:respondent, :body) en...
# Encoding: UTF-8 # # # Relax. # # You've earned it. # # # # # # require "gosu" #require_relative 'chingu/chingu' require_re...
require 'test_helper' class JurusansControllerTest < ActionDispatch::IntegrationTest setup do @jurusan = jurusans(:one) end test "should get index" do get jurusans_url assert_response :success end test "should get new" do get new_jurusan_url assert_response :success end test "shoul...
# Helper Method #notes on these helper methods, and my original solutions are on my game_status.rb file def position_taken?(board, index) !(board[index].nil? || board[index] == " ") end # Define your WIN_COMBINATIONS constant WIN_COMBINATIONS = [ [0,1,2], #top_row_win [3,4,5], #middle_row_win [6,7,8], #bottom...
require 'platform-api' class RestartAppJob < ApplicationJob queue_as :restarts class Dyno attr_accessor :type attr_accessor :name attr_accessor :state def self.connection if ENV['RESTART_API_KEY'] @@connection ||= PlatformAPI.connect_oauth(ENV['RESTART_API_KEY']) end end ...
# squaring_an_argument.rb # Using the `multiply` method from the "Multiplying Two Numbers" problem, write # a method that computes the square of its argument (the square is the result # of multiplying a number by itself). def square(number) number * number end puts square(5) == 25 puts square(-8) == 64 puts '------...
require 'calabash-cucumber/ibase' class LoginScreen < Calabash::IBase include GoBike::IOSHelpers def login_button trait end def email_field "textField placeholder:'Enter Your Email'" end def password_field "textField placeholder:'Password'" end def trait "label marked:'LOGIN'" end def login(emai...
class Api::V1::GateTypesController < ApplicationController before_action :set_gate_type, only: [:show, :update, :destroy] before_action :set_material, only: [:index, :create] def index render json: material.gate_type end def show end def create @gate_type = @material.gate_types.new(gate_type_p...
require 'rails_helper' describe "error when attempting unrecognized route", type: :request do let!(:user) {FactoryGirl.create(:user)} it 'returns status code 404 for an authenticated user and an unrecognized request' do get '/not_a_route', params: {token: user.token} expect(response.message).to eq("Not Fo...
require 'rails_helper' RSpec.describe "admin/districts/show", type: :view do let(:city) { FactoryGirl.create :city } before(:each) do @district = assign(:district, District.create!( :name => "Name", :city => city, :permalink => "Permalink" )) end it "renders attributes in <p>" do ...
class CreateCpus < ActiveRecord::Migration[5.2] def change create_table :cpus do |t| t.integer :computer_id t.integer :type_core t.float :clock_rate t.timestamps end end end
# # Класс Route (Маршрут). # class Route attr_reader :stations def initialize(start_station,end_station) @stations = [start_station,end_station] end def add_station(station) @stations.insert(-2,station) end def remove_station(station) return unless @stations.include?(station) @stations.d...
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "handlebars_wax/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "handlebars_wax" s.version = HandlebarsWax::VERSION s.authors = ["Becky Carella", "Matt Goggin"] ...
#-------------------------------------------------------------------------- # Lock Party Leader Snippet # Authors: # Racheal / Yato # Nathan Frost #-------------------------------------------------------------------------- # A snippet from this script that simply brings up a message that prevents # the main actor from...
require 'nokogiri' require 'date' module Markio class Parser # @return [Object] # Nokogiri::HTML data def initialize data @document = Nokogiri::HTML data end # Finds an object or list of objects in the db using a query # # @return [String, Array<String>, nil] the object or o...
dir = File.dirname(__FILE__) $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include? dir require "cinch" require "cinch/commands" require "cinch/plugins/identify" require "cinch/plugins/integrate" require "cinch/plugins/auth-autovoice" require "cinch/plugins/http_server" require "dm-sqlite-adapter" require "dm-migrations" ...
# frozen_string_literal: true # Value object - date range class DateRange < ValueObject attr_reader :start_date, :end_date def initialize(start_date:, end_date:) # rubocop:disable Lint/MissingSuper @start_date = start_date.beginning_of_day @end_date = end_date.end_of_day end def to_s "from #{star...
require 'binary_search' describe '#binary_search' do let(:array) { [1, 2, 3, 4, 5] } it 'returns index of element if found' do expect(array.binary_search(1)).to eq 0 expect(array.binary_search(2)).to eq 1 expect(array.binary_search(3)).to eq 2 end it 'returns nil if element was not found' do ...
require 'octoauth' require 'octokit' require 'faraday-http-cache' ## # Define Tasks and related objects for Taskit module Taskit ## # Cache layer for GitHub API API_CACHE = Faraday::RackBuilder.new do |builder| builder.use Faraday::HttpCache builder.use Octokit::Response::RaiseError builder.adapter F...
require 'spec_helper' describe Admin::EventsController do describe "GET new" do let(:user) { Fabricate(:user) } it "sets @event" do get :new expect(assigns(:event)).to be_instance_of(Event) end it "does not allow non-Admin users to access admin pages" do # Sanity check expe...
describe Complaint do describe ".by_ia_number" do let!(:complaint_1) { Complaint.create({ia_number: "101"}) } let!(:complaint_2) { Complaint.create({ia_number: "102"}) } it "returns a hash by ia number" do expect(Complaint.by_ia_number(["101", "102", "103"])).to eql({ "101" => complaint_1, ...
require 'helper_classes' begin require 'serial_modem' module Network module Device class Serial < Stub attr_accessor :connection_reset include HelperClasses::DPuts include HelperClasses::System include SerialModem include Observable #@ids = [{bus: 'usb', ...
class Dancer attr_reader(:card) attr_accessor(:name, :age) def initialize(name, age) @name = name @age = age @new_name = "" @card = [] @tutu_color = "" end # def age=(value) # @age = value # end # def name=(value) # @name = value # end # def name # @name # end # def age # @age # end ...
class ApplicationMailer < ActionMailer::Base require 'mailgun' default from: "notifications@sandboxb478b65d1ad94458945aa2e6e6549bba.mailgun.org" layout 'mailer' end
require 'spec_helper' describe PerlWatch do describe 'Validation' do it { should validate_presence_of :name } end it 'should import data from CPAN' do page = `cat spec/data/02packages.details.txt` url = 'http://www.cpan.org/modules/02packages.details.txt' FakeWeb.register_uri(:get, ...
require 'cell' describe Cell do context "a cell knows it's locations" do it "should know it's row" do expect(Cell.new(0,0).row).to eq(0) expect(Cell.new(0,8).row).to eq(0) expect(Cell.new(0,9).row).to eq(1) expect(Cell.new(0,26).row).to eq(2) expect(Cell.new(0,27).row).to e...
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" config.vm.network "private_network", ip: "192.168.33.10" config.vm.hostname = "dev" config.vm.provider :virtualbox do |v| v.customize ["modifyvm", :id, "--memory", 2048] end c...
class Movie < ActiveRecord::Base validates :title, uniqueness: {scope: :year} validates :image_url, format: {with: /\Ahttp:\/\/+.+/} validates :year, format: {with: /[12]\d{3}/} validates :plot, format: {with: /[12]\d{3}/} end
# == Schema Information # # Table name: quizzes # # id :integer not null, primary key # name :string(255) # created_at :datetime not null # updated_at :datetime not null # show_quiz :boolean default(FALSE) # class Quiz < ActiveRecord::Base attr_accessible :name h...
module WhiskeysHelper def setup_whiskey(whiskey) if whiskey.distillery == nil whiskey.build_distillery end if whiskey.category == nil whiskey.build_category end return whiskey end def get_distilleries_to_id_hash distilleries = Distillery.find(:all, :order => :name) dists_...
module Trie class CharNode attr_accessor :value, :count, :children def initialize(char) @value = char @count = 1 @children = {} end def add_child(char) # Increment this node's sort order if the letter already exists. if node = find_child(char)...
class WordCounter def initialize(target) @file = File.read(target) end def count puts "Number of words is #{@file.split.length}." end def uniq_count puts "Number of unique words is: #{@file.split.uniq.length}." end def frequency words = Hash.new(0) @file.split.each do...
json.array!(@items) do |item| json.id item.id json.title item.title json.thumb item.image(:thumb) json.image item.image(:original) json.release_date item.release_date end
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rails-assets-angular-cache/version' Gem::Specification.new do |spec| spec.name = "rails-assets-angular-cache" spec.version = RailsAssetsAngularCache::VERSION spec.authors ...
class Dog attr_accessor :id, :name, :breed def initialize(attributes) @name = attributes[:name] @breed = attributes[:breed] @id = attributes[:id] end def self.new_from_db(row) new_dog = self.new Hash.new() new_dog.id = row[0] new_dog.name = row[1] new_dog.breed = row[2] ne...