text
stringlengths
10
2.61M
# Decide what objects/models you want to use, I used pirates and ships, you can use this or anything else. # Make a nested form (this should probably have labels so it makes sense to a user). # After a user clicks submit they should be taken to a page that displays all the information we just posted from the form. In m...
Given(/^a valid client id and a valid secret$/) do ENV['PERSONA_OAUTH_CLIENT'] = 'primate' ENV['PERSONA_OAUTH_SECRET'] = 'bananas' end Given(/^an invalid client id and an invalid secret$/) do ENV['PERSONA_OAUTH_CLIENT'] = 'complete' ENV['PERSONA_OAUTH_SECRET'] = 'rubbish' end Given(/^I am authenticated as a s...
class AddLinkedUserIdToEntries < ActiveRecord::Migration[5.1] def change add_column :entries, :linked_user_id, :id end end
require 'cld_native' module CLD class Language attr_accessor :code, :name end class PossibleLanguage attr_accessor :name, :score end class LanguageResult attr_accessor :probable_language, :reliable, :possible_languages end class Detector def initialize @native = CLDNative.new ...
# Write a method that takes two strings as arguments, determines the longest of the two strings, # and then returns the result of concatenating the shorter string, the longer string, and the # shorter string once again. You may assume that the strings are of different lengths. # Understand the problem: # Pass two s...
# 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...
class ApplicationController < ActionController::API before_action :configure_permitted_parameters, if: :devise_controller? rescue_from ActiveRecord::RecordNotUnique, with: :record_not_unique def render_jsonapi_response(resource) if resource.errors.empty? render jsonapi: resource else render ...
class Yajl < DebianFormula homepage 'http://lloyd.github.com/yajl/' url 'http://github.com/lloyd/yajl/tarball/1.0.12' md5 '70d2291638233d0ab3f5fd3239d5ed12' name 'yajl' section 'libs' version '1.0.12' description 'Yet Another JSON Library - A Portable JSON parsing and serialization library in ANSI C' ...
class ProgrammesController < ApplicationController include IndexPager before_filter :programmes_enabled? before_filter :find_requested_item, :only=>[:show,:admin, :edit,:update, :destroy,:initiate_spawn_project,:spawn_project] before_filter :find_assets, :only=>[:index] before_filter :is_user_admin_auth,:exc...
FactoryBot.define do factory :accessory do name { Faker::Device.unique.model_name } cost { Faker::Commerce.price(range: 0..100.0) } qty { 10 } status_label company model { association :model, company: company } vendor { association :vendor, company: company } end end
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources :users, only: %i[new create show] resources :sessions resources :posts resources :comments, only: %i[create destroy] get "logout" => "sessions#destroy", :as => "lo...
class CalculateDeliveryDate attr_reader :event_date BANK_HOLIDAYS = [ Date.new(2017, 1, 2), Date.new(2017, 1, 16), Date.new(2017, 2, 20), Date.new(2017, 5, 29), Date.new(2017, 7, 4), Date.new(2017, 9, 4), Date.new(2017, 10, 9), Date.new(2017, 11, 11), Date.new(2017, 11, 23), Date.new(201...
# encoding: UTF-8 module Unicafe class Restaurant LIST_OF_RESTAURANTS = { 1 => {name: "Metsätalo", latitude: "60.172577", longitude: "24.948878"}, 2 => {name: "Olivia", latitude: "60.175077", longitude: "24.952979"}, 3 => {name: "Porthania", latitude: "60.169878", longitude: "24.948669"}, ...
module HBase module Response class RowResponse < BasicResponse def parse_content(raw_data) doc = REXML::Document.new(raw_data) row = doc.elements["row"] columns = [] count = 0 row.elements["columns"].each do |col| name = col.elements["name"].text.strip.unpac...
# https://leetcode-cn.com/problems/add-two-numbers/ # 2. 两数相加 # Definition for singly-linked list. # class ListNode # attr_accessor :val, :next # def initialize(val) # @val = val # @next = nil # end # end # @param {ListNode} l1 # @param {ListNode} l2 # @return {ListNode} def add_two_number...
# # BEGIN COMPLIANCE_PROFILE # def catalog_to_map(catalog) catalog_map = Hash.new() catalog_map['compliance_map::percent_sign'] = '%' catalog_map['compliance_map'] = { 'version' => @api_version, 'generated_via_function' => Hash.new() } catalog.resources.each do |resource| # Ignore...
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Users', type: :request do describe 'UserCreateAPI' do it 'ユーザー作成できる' do post '/api/v1/signup', params: { user: { name: 'user', email: 'test@example.com', password: 'password', password_confirmation: 'password' } } json = JSON.parse...
class ChangeLadyDoctor < ActiveRecord::Migration def change change_column :lady_doctors, :name, :string, :null => false change_column :lady_doctors, :doctor_number, :integer, :null => false end end
class Band < ActiveRecord::Base attr_accessible :name, :artist_ids validates :name, presence: true has_many :albums has_many :tracks, through: :albums has_many :songs, through: :tracks has_many :memberships has_many :artists, :through => :memberships end
class Spawner attr_accessor :inputs, :random, :shape, :previous_nodes def initialize(inputs, shape, random) @random = random @shape = shape @inputs = inputs end def spawn @previous_nodes = inputs shape.map do |layer_nodes| layer = build_layer(layer_nodes) @previous_nodes += laye...
class CreateRaids < ActiveRecord::Migration[5.2] def change create_table :raids do |t| t.references :gym, foreign_key: true t.string :boss t.datetime :time t.integer :remaining_time, default: 44 t.boolean :expired, default: false t.timestamps end end end
class CoursesController < ApplicationController rescue_from ActiveRecord::RecordNotFound, with: :render_not_found_response def index courses = Course.all render json: courses, include: ['chapters', 'quiz_questions', 'quiz_questions.quiz_answers'] end def show course = find_course render json...
class Subject < ActiveRecord::Base attr_accessible :abbr, :name, :alias #alias for this subject, i.e. "cs" for computer science validates :abbr, presence:true, uniqueness: { case_sensitive: false} has_many :sessions, :through => :courses has_many :courses def toString self.abbr + " - " + self.name e...
=begin #=============================================================================== Title: Shared EXP Author: Hime Date: May 17, 2013 -------------------------------------------------------------------------------- ** Change log May 17, 2013 - removed unnecessary type casting May 13, 2013 - Initial rele...
# frozen_string_literal: true # == Schema Information # # Table name: yh_photo_fr_ynas # # id :bigint(8) not null, primary key # action :string # service_type :string # content_id :string # date :date # time :time # urgency :string # category ...
class AddEmailbodyToRedeemable < ActiveRecord::Migration def change add_column :redeemables, :email_body, :text add_column :redeemables, :go_to_link, :string end end
class ImagesController < AttachmentsController skip_before_filter :verify_authenticity_token before_action :set_image, only: [:show, :edit, :update, :destroy] load_and_authorize_resource # POST /attachments # POST /attachments.json def create unless params[:id].present? @image = Image.new(image...
module Api module V1 class CarsController < ApiController before_action :set_car, only: [:show, :edit, :update, :destroy] before_action do headers['Access-Control-Allow-Origin'] = '*' headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS' headers['Access-Co...
class CreateSearches < ActiveRecord::Migration[5.2] def change create_table :searches do |t| t.string :keywords t.string :student_name t.integer :result_min t.integer :result_max t.string :comment t.string :assignment t.timestamps end end end
Pod::Spec.new do |s| s.name = "DDTCPClient" s.version = "0.0.7" s.summary = "A client of socket" s.homepage = "https://github.com/longxdragon/DDTCPClient" s.license = "MIT" s.author = { "longxdragon" => "longxdragon@163.com" } s.platform = :ios, "8.0" s.source ...
require 'test_helper' class CollaborationTest < ActiveSupport::TestCase setup do setup_default_profiles @owner = @dragon @collaborator = @lion @submission = submissions(:dragon_lion_collaboration_image_1) end test "cannot have duplicate profiles for the same submission" do assert_no_differe...
require 'rails_helper' RSpec.describe User, type: :model do describe 'associations' do it { is_expected.to respond_to(:galleries) } end describe 'validations' do context 'should be valid' do it { expect(create(:user)).to be_valid } end context 'shouldn\'t be valid' do it 'should not...
class Cart < ApplicationRecord has_many :cart_items, dependent: :destroy validates_associated :cart_items def add_product(dish) current_item = cart_items.find_by(dish_id: dish.id) if (current_item) current_item.quantity += 1 else current_item = cart_items.build(dish_id: dish.id) cur...
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Resources class Importer DEFAULT_ENGINE = :mri class << self def requirement(name, *args) const_name = "#{name.to_s.capitalize}Requirement".to_sym requ...
FactoryGirl.define do factory :contestant do sequence :email do |n| "valid#{n}@example.com" end password 'supersecret' first_name 'Jenny' last_name 'Smith' public_name 'jenny from the block' phone '5558675309' end factory :admin, class: Contestant do sequence :email do |n|...
# Ride >- Driver ✅ # Ride >- Passenger ✅ # Driver -< Ride >- Passenger class Ride attr_reader :driver, :passenger @@all = [] def initialize(pick_up, destination, cost, driver, passenger) @pick_up = pick_up @destination = destination @cost = cost # ⭐️ a ride belongs to a driver @driver = dr...
class MessagesController < ApplicationController def index @groups = current_user.groups @group = Group.find(params[:group_id]) @message = Message.new @messages = current_user.messages respond_to do |format| format.html format.json { @new_messages = @group.messages.where('id ...
class User < ApplicationRecord has_secure_password has_many :answers has_many :questions end
class AddBatchWiseStudentReportIdInGeneratedReportBatches < ActiveRecord::Migration def self.up add_column :generated_report_batches, :batch_wise_student_report_id, :integer add_index :generated_report_batches, :batch_wise_student_report_id, :name => "index_on_report" end def self.down remove_column ...
class CreateCovers < ActiveRecord::Migration def change create_table :covers do |t| t.integer :offset_x t.integer :offset_y t.text :source t.integer :facebook_id t.belongs_to :event, index: true t.timestamps end end end
# To take advantage of Heroku’s realtime logging, you will need to disable this buffering to have log messages sent straight to Logplex. $stdout.sync = true # The latest changesets to Ruby 1.9.2 no longer make the current directory . part of your LOAD_PATH # # http://stackoverflow.com/questions/2900370/why-does-ruby-...
require 'tempfile' class Emulation def initialize(emulator, assembly) self.emulator = emulator self.assembly = assembly end def run(ram, output_addresses, cycle_count) Tempfile.open('output') do |output_file| Tempfile.open(['assembly', '.asm']) do |assembly_file| assembly_file.write as...
require 'spec_helper' describe ContestsController do # TODO # check time describe 'GET /index' do it 'should respond failure' do get :index expect(response).not_to be_success end describe 'when contestant logged in' do include_examples 'login contestant' it 'should respon...
# Represents application's configuration class Config < ApplicationRecord EUR_KOEF = 70 USD_KOEF = 60 validates :koef_eur, :koef_usd, presence: true class << self def koef_eur Config.last.try(:koef_eur) || EUR_KOEF end def koef_usd Config.last.try(:koef...
class ChangePushNumber < ActiveRecord::Migration[5.2] def change rename_column :pushers, :pusher_number, :pusher_id end end
def word_sizes(input) array = input.split hash = {} array.each do |word| if hash.keys.include?(word.length) hash[word.length] += 1 else hash[word.length] = 1 end end hash end puts word_sizes('Four score and seven.') == { 3 => 1, 4 => 1, 5 => 1, 6 => 1 } puts word_sizes('Hey diddle did...
require "jani/from_json/movie" FactoryGirl.define do factory :movie, class: Jani::FromJson::Movie do uuid "cfcce0c6-e046-429f-89c0-8a24202ecf89" frame_height 360 frame_width 640 fps 13 pixel_ratio 2 loading_banner nil postroll_banner nil strips [] tracking_events [] conversion...
class ChangeWorkOrderPrimary < ActiveRecord::Migration def self.up rename_column :work_orders, :primary, :level end def self.down rename_column :work_orders, :level, :primary end end
# # Z - public procurements in Ukraine, (cc) dvrnd for texty.org.ua, 2012 # require 'rubygems' require 'json' require 'sinatra' require 'data_mapper' require 'pony' require 'nokogiri' require 'open-uri' load 'settings.rb' load "models.rb" load "lib/helpers.rb" def construct_query query_conditions, params if par...
Sequel.migration do change do create_table :work_queue do primary_key :id String :task String :data end end end
class HostsController < ApplicationController before_action :authenticate_user! def update @host = current_user.host if @host.update(host_params) flash[:success] = "Host updated!" end redirect_to root_path end private def host_params params.require(:host).permit(:address_1, :stat...
class CreatePinPads < ActiveRecord::Migration # 密码键盘 password_pad #接口 interface #语音 voice #防窥罩 anti_peep_cover def self.up create_table :pin_pads do |t| t.string "interface" t.string "voice" t.string "anti_peep_cover" t.text "memo" t.timestamps end end def ...
require 'rails_helper' RSpec.describe ProposalSituation, type: :model do it 'has a valid factory' do expect(create :proposal_situation).to be_valid end it { should validate_presence_of :name } it { should have_many :proposals } end
# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # VM ONE ==...
# bubble sort works by swapping value pairs # we make a number of passes through the array we want to sort # at each pass, the following happens: # for every index (starting with 0): # compary array[index] and array[index + 1] # if the first is larger than the second, swap them. # we do as many passes as needed to reac...
class Test1 # Example: # Test1.new.add(1, 2) # => 3 # Test1.new.add(1, "something") # => TypeError: String can't be coerced into Fixnum def add(num1, num2) num1 + num2 end end
json.shops do json.array! @shops do |shop| json.id shop.id json.name shop.name json.books_sold_count shop.shop_items.with_state(:sold).joins(book: :publisher).where("publishers.id = ?", @publisher_id).count json.books_in_stock count_available_books_in_store(shop) end end
class AddArticleReferenceToEntry < ActiveRecord::Migration[4.2] def change add_reference :entries, :article, index: true, foreign_key: true end end
module Mongoid::TaggableWithContext::AggregationStrategy module RealTime extend ActiveSupport::Concern included do set_callback :create, :after, :increment_tags_agregation set_callback :save, :after, :update_tags_aggregation set_callback :destroy, :before, :store_reference_to_tag...
class Kcov < Formula desc "Code coverage tool for compiled programs, Python and Bash" homepage "http://simonkagstrom.github.com/kcov/index.html" url "https://github.com/SimonKagstrom/kcov/archive/v36.tar.gz" sha256 "29ccdde3bd44f14e0d7c88d709e1e5ff9b448e735538ae45ee08b73c19a2ea0b" depends_on "cmake" => :buil...
require 'rspec' require './lib/ingredient' require './lib/recipe' describe Recipe do before do @cheese = Ingredient.new("Cheese", "oz", 50) @mac = Ingredient.new("Macaroni", "oz", 200) @mac_and_cheese = Recipe.new("Mac and Cheese") end it "exists" do expect(@mac_and_cheese).to be_...
class Bid < ActiveRecord::Base validates_presence_of :item_id, :color, :amount, :timestamp belongs_to :item def self.external_exists?(external_id) Bid.exists? external_id: external_id end end
# frozen_string_literal: true require 'selenium-webdriver' RSpec.configure do |config| config.before do |example| options = Selenium::WebDriver::Options.chrome(browser_version: '94', platform_name: 'Windows 10', ...
class PurchasesController < ApplicationController before_action :authenticate_user!, only: :create before_action :its_admin?, only: [ :update, :dashboard, :destroy ] def create product = Product.find(params[:product_id]) purchase = Purchase.new purchase.product = product purchase.user = current_...
require 'json' require "net/http" require "uri" MAX_ATTEMPTS=50 TIMESTAMP = Time.now.strftime('%FT%T').gsub(/:|-/,'') PARAMETERS = {SSHKeyName: ENV['SSHKEYNAME']} def get_expanded_params expanded_params = '--parameters ' PARAMETERS.each_pair { |key, value| expanded_params << "ParameterKey=#{key},ParameterValue=#{...
require 'rails_helper' RSpec.describe Item, type: :model do before do @item = FactoryBot.build(:item) end describe "出品商品登録" do context "出品登録できるパターン" do it "全て条件通りの入力をすると新規登録できる" do expect(@item).to be_valid end end context "出品登録できないパターン" do it "商品名がないと登録できない" do ...
require 'spec_helper' module Naf describe QueuedJob do # Mass-assignment [:application_id, :application_schedule_id, :application_type_id, :command, :application_run_group_restriction_id, :application_run_group_name, :application_run_group_limit, :priority].each do |a| ...
module Rubicus::Layers class Base protected def convert_options(obj) case obj when String obj.gsub("\n", "\\n") when Array if obj[0].kind_of? Array obj.map { |row| row.join(" ") }.join else obj.join(" ") end when Hash obj.map ...
module Dotpkgbuilder class Scripts < Stage delegate :working_dir, :scripts_dir, :pkg_dir, to: :context PREINSTALL_FILE = "preinstall".freeze POSTINSTALL_FILE = "postinstall".freeze SCRIPTS_FILE = "Scripts".freeze def preinstall_file PREINSTALL_FILE end def preinstall? File....
# based on: # BustRailsCookie.rb by Corey Benninger require 'cgi' require 'base64' require 'openssl' require 'active_record' require 'optparse' banner = "Usage: #{$0} [-h HASHTYPE] [-w WORDLIST_FILE] <cookie value--hash>" ########################## ### Set Default Values ### ########################## hashtype = '...
# Add a declarative step here for populating the DB with movies. Given /the following movies exist/ do |movies_table| movies_table.hashes.each do |movie| # each returned element will be a hash whose key is the table header. # you should arrange to add that movie to the database here. Movie.create! movie ...
require 'snmp2mkr/oid' module Snmp2mkr class Metric def initialize(vhost, name, oid, mib: nil, transformations: []) @vhost_name = vhost.name @name = name @oid = oid.kind_of?(Oid) ? oid : Oid.new(oid, mib: mib) @transformations = transformations end attr_reader :vhost_name, :name...
class CreateSnippetsTagsTable < ActiveRecord::Migration def change create_join_table :snippets, :tags end end
class AddFuelLpgToReport < ActiveRecord::Migration def change add_column :reports, :fuel_cost_lpg, :integer, after: :fuel_cost, null: false, default: 0 end end
class UserDecorator < Draper::Decorator delegate_all def full_address "#{object.street_address}, #{object.city}, #{object.state} #{object.zip}" end def created_at object.created_at.strftime("%m-%d-%Y") end def trial_expiration (object.created_at + 30.days).strftime("%m-%d-%Y") end end
require 'rails_helper' RSpec.describe "admin/topics/index", type: :view do before(:each) do assign(:admin_topics, [ Admin::Topic.create!(), Admin::Topic.create!() ]) end it "renders a list of admin/topics" do render end end
require 'axlsx' class LegalServices::SupplierSpreadsheetCreator def initialize(suppliers, params) @suppliers = suppliers @params = params end def build Axlsx::Package.new do |p| p.workbook.add_worksheet(name: 'Supplier shortlist') do |sheet| sheet.add_row ['Supplier name', 'Phone numbe...
ActiveAdmin.register Bar do index do column "Logo" do |bar| image_tag bar.logo.thumb('100x100').url end column :name column :city column :freebeer column "Visits" do |bar| bar.visits.count end default_action...
require "seasons_of_love/version" require 'active_support/core_ext' module SeasonsOfLove #date trick taken from http://stackoverflow.com/questions/925905/is-it-possible-to-create-a-list-of-months-between-two-dates-in-rails # -Dylan def self.split_dates_into_ranges(start_date, end_date, opts={}) months = [] ...
class Song attr_accessor :name, :artist, :genre def initialize(name, genre) @name= name @genre = genre end def artist_name self.artist.name end end
class Review < ApplicationRecord belongs_to :user belongs_to :menu validates :content, presence: true, length: { maximum: 300 } default_scope -> { order(created_at: :desc) } end
class Special def initialize @should_resume = false end def execute_from_game(game, player, events) puts "Special executing for #{player.name}" execute(game, player, events) if @should_resume puts "After execution, resuming card play" game.continue_card(events) else puts "Yield execution of card...
class SubscriptionsController < ApplicationController include EventSource before_action :authenticate def new @subscription = CreateSubscriptionCommand.new topic_id: params[:topic_id] end def edit @subscription = UpdateSubscriptionCommand.new Subscription.find(id_param).updatable_attributes end ...
Rails.application.routes.draw do resources :questions resources :members root to: 'members#index' get '/incoming' => 'answers#incoming' end
require 'optparse' require 'highline/import' module Chat class Client class CLI def self.execute(args) host = Chat::DEFAULT_HOST port = Chat::DEFAULT_PORT # parse command-line arguments parser = OptionParser.new do |opts| opts.on("-h", "--host=HOST", "Host to conn...
require "test_helper" require "minitest/stub/const" class StopwatchTest < Minitest::Test def test_benchmark_is_used_to_time_execution # Create a mock BenchmarkTms object to be returned from Benchmark#measure benchmark_timing_mock = Minitest::Mock.new benchmark_timing_mock.expect(:real, 1.23) # Creat...
name 'motd-tail' maintainer 'Chef Software, Inc.' maintainer_email 'cookbooks@chef.io' license 'Apache-2.0' description 'Updates motd.tail with Chef Roles' version '5.1.0' %w(debian ubuntu).each do |os| supports os end source_url 'https://github.com/chef-cookbooks/motd-tail' issues_url 'https://github.com/chef-cook...
require "test_helper" class AddEventsControllerTest < ActionDispatch::IntegrationTest setup do @add_event = add_events(:one) end test "should get index" do get add_events_url, as: :json assert_response :success end test "should create add_event" do assert_difference('AddEvent.count') do ...
module Mailbox class DaemonThreadFactory def newThread(r) thread = java.lang.Thread.new r; thread.set_daemon true; return thread; end end end
# encrypt method # move forward every letter of a string # "abc" and want to get "bcd" # assume lowercase input and output # reverse that! # "bcd" back to "abc" def encrypt (secret_string) # loop over the string # for every index take that character and move forward one counter = 0 while counter < secret_string....
require 'test_helper' class ResponsesControllerTest < ActionDispatch::IntegrationTest # test "the truth" do # assert true # end def setup @email = 'hoge@email.com' @user = User.new(name: 'hoge', nickname: 'hogechan', email: @email, passwo...
class PhotosController < ApplicationController before_action :require_current_user, except: [:show, :search] def index render text: "Coming soon!" end def show @photo = Photo.find(params[:id]) end def new @photo = Photo.new end def create @photo = Photo.new(photo_params) @photo....
# require 'spec_helper' # # describe HeatsController do # # def mock_heat(stubs={}) # @mock_heat ||= mock_model(Heat, stubs).as_null_object # end # # describe "GET index" do # it "assigns all heats as @heats" do # Heat.stub(:all) { [mock_heat] } # get :index # assigns(:heats).should e...
# frozen_string_literal: true require 'json' require 'open-uri' require 'net/https' require './lib/models.rb' def get_sticker_data(stkver, stkopt, stkid, stkpkgid) base_uri = "https://dl.stickershop.line.naver.jp/products/0/0/#{stkver}/#{stkpkgid}" info_uri = base_uri + '/iphone/productInfo.meta' sticker_uri =...
class UserMoodsController < ApplicationController before_action :set_user_mood, only: [:show, :destroy, :update] before_action :greeting, only: [:show, :index] def index @usermoods = @current_user.user_moods end def show end def new @usermood = UserMood.new end def create mood = Moo...
class User < ActiveRecord::Base ROLES = %w[user admin root] devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable has_attached_file :avatar, :styles => { retina_medium: "400x800>", medium: "200x400>", thumb: "50x50#", retina_thumb: "100x200>" }, :default_...
class RenameLeagueField < ActiveRecord::Migration def change rename_column :matches, :league, :league_id end end
# Create license mappings class CreateLicenseMappings < ActiveRecord::Migration def change create_table :license_mappings do |t| t.references :mappable, polymorphic: true, index: true t.references :license, index: true, foreign_key: true end end end
# coding: utf-8 require File.expand_path(File.dirname(__FILE__) + '/spec_helper') include SimilarityEngineSimilarity describe SimilarityEngine do context 'uninitialized' do describe '#initialize' do context 'when call' do it 'CosineSimilarity' do engine = SimilarityEngine.new en...
class Student attr_accessor :first_name @@all = [] def initialize(first_name) @first_name = first_name @@all << self end def self.all @@all end def tests_taken BoatingTest.all.select do |test| test.student == self end end def i...