text
stringlengths
10
2.61M
class RemoveOwnerFromSupply < ActiveRecord::Migration[5.0] def change remove_column :supplies, :owner, :integer end end
module Ricer::Plugins::Convert class Decode < Ricer::Plugin trigger_is :decode has_usage '<encoding> <..string..>' def execute(encoding, string) reply string.force_encoding(encoding.to_label) end end end
# You are given an array(list) strarr of strings and an integer k. # Your task is to return the first longest string consisting of k consecutive strings taken in the array. # Examples: # strarr = ["tree", "foling", "trashy", "blue", "abcdef", "uvwxyz"], k = 2 # Concatenate the consecutive strings of strarr by 2, we g...
# encoding: utf-8 module XLSSestavy VERSION = "0.3.4" end
class AddViewsToVideoUsers < ActiveRecord::Migration def change add_column :video_users, :views, :integer, default: 0 end end
# frozen_string_literal: true # == Schema Information # # Table name: book_authors # # id :bigint(8) not null, primary key # created_at :datetime not null # updated_at :datetime not null # author_id :bigint(8) # book_id :bigint(8) # # Indexes # # index_book_authors_on_author_id...
class Quiz < ActiveRecord::Base belongs_to :user has_many :quiz_question, dependent: :destroy end
require_relative "Clutch" class Throw def initialize(object_array) @last_report = nil @throw_array = object_array @tally_report = Hash.new @sum_report = Hash.new end def return() return_clutch = Clutch.new for i in (0..@throw_array.size-1) ...
class AddClusterIdToProsumer < ActiveRecord::Migration def change add_column :prosumers, :cluster_id, :integer end end
require 'minitest_helper' describe JsonStructure::Integer do it do js = build { integer(min: 0, max:10) } assert js === 0 assert js === 10 refute js === 'str' refute js === 0.5 refute js === 10.5 end end
class CreateUsers < ActiveRecord::Migration[6.0] def change create_table :users do |t| t.string :first_name, null: false t.string :last_name, null: false t.string :id_number,null: false t.string :phone_number, null: false t.string :pin, default: "1234" t.float :balance, null: f...
module EtfsService extend self ## ONLY CALL etfs_json ONCE! Or cache it in method ## def get_as_json return etfs_json end def get_as_objects top_level = Hashie::Mash.new(JSON.parse(etfs_json)) # FIXME: Rails will deserializing longer decimal values as BigDecimals, which # then get dumped ...
# encoding: utf-8 control "V-54021" do title "Use of the DBMS installation account must be logged." desc "The DBMS installation account may be used by any authorized user to perform DBMS installation or maintenance. Without logging, accountability for actions attributed to the account is lost.false" impact 0.5 tag...
class SlackMembersController < ApplicationController before_action :set_slack_member, only: [:show, :edit, :update, :destroy] # GET /slack_members # GET /slack_members.json def index @slack_members = SlackMember.all end # GET /slack_members/1/edit def edit end # PATCH/PUT /slack_members/1 # P...
require 'test_helper' class CalendarsControllerTest < ActionDispatch::IntegrationTest setup do @calendar = calendars(:one) end test "should get index" do get calendars_url assert_response :success end test "should create calendar" do assert_difference('Calendar.count', 1) do post cale...
# from http://railscasts.com/episodes/207-syntax-highlighting-revised?view=asciicast class HTMLwithPygments < Redcarpet::Render::HTML def block_code(code, language) Pygments.highlight(code, lexer: language) rescue Pygments.highlight(code) end end
################################################# # AWS Credentials Tests ################################################# # See that the local system environment variables are formed correctly. # These might be expired or invalid so we test them in the next step. control 'check-aws-api-credentials' do impact 1.0 ...
data_bag_name = node["sensu"]["data_bag"]["name"] enterprise_item = node["sensu"]["data_bag"]["enterprise_item"] begin unless get_sensu_state(node, "enterprise") enterprise = Sensu::Helpers.data_bag_item(enterprise_item, true, data_bag_name) set_sensu_state(node, "enterprise", enterprise) end rescue => e ...
class AddIngestedToBudgets < ActiveRecord::Migration[6.0] def change add_column :budgets, :ingested, :boolean, default: false end end
class ProjectImagesController < ApplicationController def edit @image = ProjectImage.find(params[:id]) @project = @image.project end def update @image = ProjectImage.find(params[:id]) @image.update_attributes(permitted_params(params)) @project = @image.project redirect_to add_images_admin...
require 'connection' require 'configuration' require 'ssh' # This library syncs existing instances between regions class Sync def self.run! (arguments = nil) Configuration::init(true) source_region, instance_id, target_region = nil # Parse command-line arguments if !arguments.nil? arguments.each do |argume...
class UsersController < ApplicationController skip_before_action :login_required, only: [:new, :confirm_new, :create] before_action :require_admin, only: [:destroy, :index] before_action :already_login, only: [:new, :confirm_new, :create] before_action :forbid_user, only: [:edit, :update] def index @q ...
class EricWeixin::WeixinUser < ActiveRecord::Base SEX = {1 => '男', 2 => '女', 0 => '未知'} self.table_name = 'weixin_users' # belongs_to :member_info belongs_to :weixin_public_account, :class_name => '::EricWeixin::PublicAccount', :foreign_key => 'weixin_public_account_id' has_many :orders, class_name: "::EricWe...
class PlansController < ApplicationController before_action :set_plan, only: [:show, :update, :destroy] # GET /plans def index @plans = Plan.all render json: @plans end # GET /plans/1 def show render json: @plan end # POST /plans def create @plan = Plan.new(plan_params) if @pl...
module Report class CommonDetailPage include NewPageWritable def initialize(project) @project = project end def write(pdf) super #draw_project_completion_data(pdf) draw_facility_name(pdf) draw_building_name(pdf) draw_servicve_type(pdf) draw_service_start_date...
RSpec.describe Export::Report do before(:all) do DatabaseCleaner.strategy = :transaction DatabaseCleaner.start financial_quarter = FinancialQuarter.for_date(Date.parse("31-Mar-2022")) financial_year = FinancialYear.for_date(Date.parse("31-Mar-2022")) @report = create( :report, financ...
# -*- coding: utf-8 -*- # # Copyright 2013 whiteleaf. All rights reserved. # require "fileutils" require "stringio" require_relative "novelsetting" require_relative "inspector" require_relative "illustration" require_relative "loadconverter" require_relative "downloader" require_relative "template" require_relative "p...
require 'active_support' require 'iconv' class OsxStringsFileParser class FauxEncodingHandler def self.convert( data ) data end end class KeyValuePair < Struct.new(:key, :value, :comments) def attributes { :text => value, :data => { 'key' => key, 'comments' => comments }} end end...
# frozen_string_literal: true require 'test_helper' # docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -e 'MSSQL_PID=Express' -p 1433:1433 mcr.microsoft.com/mssql/server:2017-latest class MiniSql::SqlServer::TestConnection < MiniTest::Test def setup @connection = sqlserver_connection # C...
require 'spec_helper' describe Jobs::ResourceMixIn do class ExampleJob < Struct.new(:model) include Jobs::ResourceMixIn def perform resource(model) end end def stub_identity Identity.stub \ :certificate => mock_certificate, :private_key => :private_key mock_cert...
class EventsController < ApplicationController def new end def create @event = Event.create(event_create_params) @errors = @event.errors.full_messages if @event.errors.present? end def show @event = Event.find_by(id: params[:id]) end def get_location @locations = LocationService.find_lo...
class PasswordListAnalyzer attr_reader :corruption_detector def initialize(corruption_detector:) @corruption_detector = corruption_detector end def valid_passwords classify_passwords.filter { |p| p[:valid] } end private attr_reader :passwords def classify_passwords tagged_passwords.map ...
#!/usr/bin/env ruby require 'rubygems' require 'bundler/setup' require 'minitest' require 'minitest/reporters' require "minitest/autorun" require "http" require "http/2" require "digest/crc32c" require_relative "proxyprotocol.rb" class BetterSpecReporter < Minitest::Reporters::SpecReporter def before_test(test) ...
class User < ApplicationRecord has_secure_password has_many :carts has_many :cartsitems, through: :carts has_many :items, through: :cartsitems validates :email, presence: true validates :email, uniqueness: true end
module GeneticProgramming module FuncList class FuncWrapper def initialize(func_proc, name, arity = nil) @proc = func_proc @name = name @arity = arity || func_proc.arity end attr_reader :name, :arity def call(*args) @proc.call(*args) end end ...
class CreateRatings < ActiveRecord::Migration def change create_table :ratings do |t| t.references :user, index: true, foreign_key: true t.references :school, index: true, foreign_key: true t.text :pros t.text :cons t.float :rating t.timestamps null: false end end end
require 'securerandom' require 'json' module InhouseEvents class Event EVENT_TYPES = { pageview: 'pageview', click: 'click', form_submission: 'form_submission' }.freeze attr_reader :payload, :type def initialize(payload = {}) @payload = payload @payload[:server_event_i...
# == Schema Information # # Table name: user_images # # id :integer not null, primary key # image :string # user_id :integer # aasm_state :string # state :integer # created_at :datetime not null # updated_at :datetime not null # likes_count :integer ...
class AddClientStatusToClient < ActiveRecord::Migration[5.1] def change add_reference :clients, :client_status, foreign_key: true end end
class GalleriesBelongTo < ActiveRecord::Migration[5.0] def change change_table :galleries do |t| t.belongs_to :visit t.belongs_to :test t.belongs_to :symptom t.belongs_to :procedure t.belongs_to :patient t.belongs_to :medication t.belongs_to :hospitalization t.belon...
class GuidesController < ApplicationController def show @article = Article.find_by_permalink params[:id] if @article.blank? return article_category_list else return permanent_redirect_to article_url(:id => @article.permalink, :article_instance => @article.article_instance.short_name) ...
module EnglishGate class Notifier attr_accessor :from, :to, :message def initialize(from, to, message) @from, @to, @message = from, to, message end end end
class InputValidator < SimpleDelegator include ActiveModel::Validations validates :amount, numericality: {only_integer: true, greater_than: 0 } validates :denomination, inclusion: {in: Coin.pluck(:denomination), message: "%{value} should be correct!"}, if: 'denomination.present?' end
require File.expand_path(File.dirname(__FILE__) + "/../test_helper") class HelperTest < ActionView::TestCase include FlexMock::TestCase self.helper_class = AdminData::Helpers def test_admin_data_get_value_for_column column = Article.columns.select {|column| column.name.to_s == 'title'}.first @article ...
class DocumentUploader < CarrierWave::Uploader::Base storage :file def filename file.filename end def file_with_relative_path if self.model.persisted? "/uploads/#{model.class.to_s.underscore}/#{mounted_as}_#{model.id}/#{file.filename}" else "/uploads/tmp/#{cache_id}/#{filename}" ...
describe 'Validação de Acesso', :validC do it 'Criar' do visit '/login' fill_in 'matricula', with: 'MMEDICO' fill_in 'senha', with: '123456' click_on 'ACESSAR' #navegação menu lateral find('.icon-open').click find('div ul li a', text: 'VALIDAÇÃO ...
require 'byebug' #time : O(n^2) #space : O(n) def bad_two_sum?(arr, target_sum) (0...arr.length).each do |i| ((i + 1)...arr.length).each do |j| return true if arr[i] + arr[j] == target_sum end end false end # arr = [0, 1, 5, 7] # p bad_two_sum?(arr, 6) # => should be true # p ...
class CreateAlliances < ActiveRecord::Migration def change create_table :alliances do |t| t.string :client_supplier_id t.string :client_recipient_id t.string :supply_id t.string :demand_id t.string :agreed_quantity t.timestamps null: false end end end
class Addorder < ActiveRecord::Migration def change add_column :profiles, :order, :integer, array: true end end
require 'spec_helper' describe Mastermind do it 'has a version number' do expect(Mastermind::VERSION).not_to be nil end it 'has class game_engine' do expect(Mastermind::Game_Engine).not_to be nil end it 'has class code_generator' do expect(Mastermind::Code_generator).not_to be nil end it...
class Widgets::Edit < Mustache::Rails def errors_display_div return "" unless widget.errors.any? content_tag("div", :id=>"errorExplanation", :class=>"errorExplanation") do content_tag("h2", error_header) + content_tag("ul") do widget.errors.full_messages.inject("") do |memo,msg| memo...
require File.dirname(__FILE__) + '/../../test_helper' class ForumsRoutingTest < ActionController::TestCase tests ForumsController def setup @forum = forums(:welcome) @user = users(:joe) @page = '2' end test 'route to :home' do assert_routing '/', { :controller => 'forums', :action => 'home' ...
require 'multi_json' MultiJson.use :yajl json.cache! @experiences.first do json.success true json.locations do json.array! @experiences.map(&:location).uniq do |location| json.type 'Feature' json.geometry do json.type 'Point' json.coordinates [location.long, location.lat] end...
source 'http://rubygems.org' gem 'rails', '3.1.0.rc6' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql2' gem "sass-rails", "~> 3.1.0.rc.6" gem 'coffee-rails', '~> 3.1.0.rc.6' gem 'uglifier' # Use unicorn as the web server gem 'unicorn' gem 'devise', '1.4.2' gem 'j...
class ApplicationController < ActionController::Base #protect_from_forgery with: :exception #include SessionsHelper before_filter :set_user before_filter :set_cache_buster def set_cache_buster response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" response.headers[...
# The reason we put two dots in the front of the following path is # that the file name in `__FILE__` is interpreted as a directory. # Therefore, we need to cd .. in order to get to the actual parent # directory. require File.expand_path('../support/helpers.rb', __FILE__) include Helpers::Cubrid TEMP_DIR = "/tmp" des...
module AcquiaToolbelt class CLI class Sites < AcquiaToolbelt::Thor # Public: List all subscriptions the user has access to. # # Returns a list of subscriptions. desc 'list', 'List all subscriptions you have access to.' def list sites = AcquiaToolbelt::CLI::API.request 'sites'...
class Person include Neo4j::ActiveNode property :name, type: String has_n(:clues).from(Clue, :persons) has_n(:organizations).from(Organization) def allies n = 1 query_as(:origin).match("p = origin<-[:`Clue#persons`]-(clue)-[:`Clue#persons`*1..#{n}]-(ally: Person)") end end
fastlane_version "1.93.0" default_platform :ios platform :ios do before_all do xcversion(version: '~> 7.3.1') sh "bundle exec pod repo update" cocoapods(silent: true) end after_all do cleanup end # desc "Build and upload to Crashlytics with (configuration (Release)), (include_bitcode ...
require 'rails_helper' RSpec.describe TransferOperation do let(:source_account) { create(:account) } let(:destination_account) { create(:account) } let(:source_account_id) { source_account.id } let(:destination_account_id) { destination_account.id } let(:amount) { '2000.00' } subject { TransferOperation.ne...
class CreateVisitorInfos < ActiveRecord::Migration def self.up create_table :visitor_infos do |t| t.integer :business_card_id t.string :browser t.string :version t.string :platform t.string :domain_name t.string :ip_address t.timestamps end end def self.down ...
class EndUsers::DepartmentsController < ApplicationController def show @department = Department.find(params[:id]) @posts = @department.set_posts end end
require 'rails_helper' RSpec.describe Password::SendResetInstructions, :auth do let(:email) { 'test@example.com' } before { create_account(email: email) } let(:op) { described_class } example 'with an email that exists' do result = nil expect do result = op.(account: { email: email }) end.to...
require 'webmock' require 'librarian' require 'librarian/helpers' require 'librarian/chef' module Librarian module Chef module Source describe Site do include WebMock::API project_path = Pathname.new(__FILE__).expand_path project_path = project_path.dirname until project_path.joi...
require 'test_helper' class InvoiceItemTest < ActiveSupport::TestCase def setup @plan = Plan.new(:name => "trial") @plan.save @account = Account.new(:name => "Masev", :subdomain => "maseva") @user = @account.users.new(email: "pbruna@gmail.com", password: "172626292") @account.save @user.save...
Given /^I have the following Ruby code:$/ do |code| @code = code end When /^I execute the code$/ do module Kernel def puts(str) OutputStorage.write("#{str}\n") end end eval(@code) end Then /^I should see \"(.+)\" in the output$/ do |text| OutputStorage.output.should =~ /#{text}/ end class ...
json.promotions @promotions do |promotion| json.partial! 'promotions/promotion', promotion: promotion end
require 'spec_helper' RSpec.describe ExternalUser do context 'class methods' do subject { described_class } describe '#find_by_uid' do let(:user) { double :user } it 'should find first user with matching uid' do allow(subject).to receive(:find).with(:first, params: { uid: 'uid' }).and_r...
# Получатель нотификации class Notification::Recipient < ActiveRecord::Base belongs_to :notification belongs_to :user state_machine initial: :pending do state :pending state :delivered event :deliver do transition pending: :delivered end inside_transition on: :deliver, &:sen...
class AddPursuitRefToOrderedTrips < ActiveRecord::Migration def change add_reference :ordered_trips, :pursuit, index: true, foreign_key: true end end
# Lambdas as case conditions # case statements use "threequals" (#===) operator to determine if a condition # matches. Ruby's Proc objects have the threequals defined as an alias to #call. # When we combine Proc#=== with case statements, we have a powerful tool for # including arbitrary predicate expression among the c...
require 'grape' require_relative 'auth_helpers' module Frontend class Collections < Grape::API resource :collections do helpers AuthHelpers before { authenticate! } helpers do def api @api ||= current_client.apis .find(params.collection.api) end ...
Rails.application.routes.draw do root 'application#home' scope module: 'api', path: 'api' do resources :customers, except: [:destroy] do resources :credit_cards resources :backs end end end
class Favorite < ApplicationRecord belongs_to :user belongs_to :post # 1User1いいねにする validates_uniqueness_of :post_id, scope: :user_id end
# olewriter.rb # # This class should never be instantiated directly. The entire class, and all # its methods should be considered private. class MaxSizeError < StandardError; end class OLEWriter # Not meant for public consumption MaxSize = 7087104 BlockSize = 4096 BlockDiv = 512 ListBlocks = 127...
class Transaction < ApplicationRecord belongs_to :account # before_create :balance # before_create :interest def balance #the difference between this and current balance is that #current balance changes every time there is a transaction last_trans = self.account.transactions[-2] if last_trans && l...
class Board def self.print_grid(grid) grid.each do |row| puts row.join(' ') end end attr_reader :size def initialize(n) @grid = Array.new(n) { Array.new(n, :N) } @size = n * n end def [](arr) @grid[arr[0]][arr[1]] end def []=(arr, val) @grid[arr[0]][arr[1]] = val end def num_s...
module WidgetHelper def widget_values(concept, relation_class) concept.concept_relations_by_id(relation_class.name.to_relation_name) end def widget_values_ranked(concept, relation_class) concepts_with_ranks = concept.concept_relations_by_id_and_rank(relation_class.name.to_relation_name) concepts_with...
require 'spec_helper' describe Immutable::Vector do describe '#reverse_each' do [2, 31, 32, 33, 1000, 1024, 1025, 2000].each do |size| context "on a #{size}-item vector" do let(:vector) { V[1..size] } context 'with a block (internal iteration)' do it 'returns self' do ...
my_num = 25 my_boolean = true my_string = "Ruby" my_num = 100 exp = 2 ** 3 # exponentional mod = 25 % 7 # modular puts "Hello " + my_string + " !" # hello =begin comment =end my_name = "Ilian" my_age = 31 sum = 13 + 379 product = 923 * 15 quotient = 13209 / 17 name = "Ilian" name.downcase.reverse.upcase # chai...
class SplitUpAdmitDischargeDataFields < ActiveRecord::Migration def change add_column :subjects, :admit_day, :integer add_column :subjects, :admit_month, :integer add_column :subjects, :admit_year, :integer add_column :subjects, :discharge_day, :integer add_column :subjects, :discharge_month, :int...
class Language < ApplicationRecord has_many :words has_many :translations has_many :texts end
class AddPositionToPassengers < ActiveRecord::Migration def self.up add_column :passengers, :position, :integer end def self.down remove_column :passengers, :position end end
require 'base64' require 'openssl' module Oauth2ProxyAuthentication HEADERS = %w( Content-Length Content-Md5 Content-Type Date Authorization X-Forwarded-User X-Forwarded-Email X-Forwarded-Access-Token Cookie Gap-Auth ) NO_SIGNATURE = 1 INVALID_FORMAT = 2 UNSUPPORTED_A...
require 'rails_helper' RSpec.describe "floor_plans/new", type: :view do before(:each) do assign(:floor_plan, FloorPlan.new( :layout => "MyString", :image_url => "MyString", :market_rent => "9.99", :property => nil )) end it "renders new floor_plan form" do render assert_...
#! /usr/bin/env ruby Main { description <<-__ growltdf is the greatest program evar. it let's you scrape http://cyclingnews.com for TDF updates and dump them into growl to you can keep up with the race while working. . to install this code - sudo gem install growltdf . to run you need ...
# keep this underscore naming in the test subdir, it's easier to append files names to test require './test/test_helper.rb' # Unit test cases for the DataMetaDom # See for instance: # - test_full class TestNewGem < Test::Unit::TestCase # an empty stub for now def setup DataMetaDom::L.level = Logger:...
class SuggestsController < ApplicationController before_action :authenticate_user!, except: [:index, :show] before_action :load_suggest, except: [:index, :new, :create, :admin_view_new] load_and_authorize_resource def index @search = Suggest.includes(:user).ransack params[:q] @suggests = @search.result...
# data collection from serial port # 2019-11-14 Naoki F., AIT # New BSD License is applied. See COPYING file for details. require 'rubygems' require 'serialport' PORT = "COM5" # modify the port according to environment BLOCK_SIZE = 4096 # Check Arguments file_name = ARGV[0] data_size = ARGV[1] ? ARGV[1].to...
class Article < ActiveRecord::Base #has_many :tag_article_assocs #has_many :tags, through: :tag_article_assocs has_and_belongs_to_many :tags validates :title, presence: true, length: { minimum: 5 }, uniqueness: true end
require "chef/provisioning/machine_options" require "chef/provisioning/azure_driver/constants" # Chef Provisioning Azure driver class Chef module Provisioning module AzureDriver # Represents available machine provisioning options for Azure # These are used to tell Azure how to construct a new VM ...
# Your Names # 1) Brian W # 2) Natasha # We spent [1.25] hours on this challenge. # Bakery Serving Size portion calculator. def serving_size_calc(item_to_make, order_quantity) # hash of 3 items with serving size values library = {"cookie" => 1, "cake" => 5, "pie" => 7} # test if item_to_make is in the libra...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception #mobile side include Jpmobile::ViewSelector before_filter :disable_mobile_view_if_tablet def disable_mob...
require 'xml/libxml' class LogEntryRetriever def initialize(svn_sheller = SvnSheller.new) @svn_sheller = svn_sheller end def retrieve log_entry_elements_in(xml_svn_log).collect do |log_entry| LogEntry.new(revision_for(log_entry), date_for(log_entry), message_for(log_entry)) end rescue Except...
require 'json' require 'httparty' require 'pp' starting_url = 'https://api-v2.soundcloud.com/users/669291/tracks?representation=&limit=200' @extra_params = 'client_id=JlZIsxg2hY5WnBgtn3jfS0UYCl0K8DOg&app_version=1503651513' @collection = [] @downloads = [] @download_location = '../../' def retrieve_collection(url) ...
require "test_helper" module AssMaintainer::InfoBasesTest describe ::AssMaintainer::InfoBases::VERSION do it 'has a version_number' do ::AssMaintainer::InfoBases::VERSION.wont_be_nil end end describe ::AssMaintainer::InfoBases::Support::TmpPath do def inst @inst ||= Class.new do ...
require 'rbconfig' IR_BIN = RbConfig::CONFIG['bindir'] IR_EXE = ::File.join(IR_BIN, 'ir.exe') require File.dirname(__FILE__) + '/../Scripts/rake_testtask' task :default => [:test] desc "Run all DLR-based Silverlight tests" Silverlight::TestTask.new :test => [:build_lib] do |t| t.browsers = %W(explorer firefox) ...
# BASIC CLASS GETTER AND SEETER class Usuario attr_accessor :nombre attr_accessor :apellido end usuario1 = Usuario.new usuario2 = Usuario.new usuario1 == usuario2 # =>false usuario1.nombre = "Matz" p usuario1.inspect # => #<User:0x007f8f4b043a30 @nombre="Matz"> p usuario1.nombre # => undefined method `nombre'...
class Game < ApplicationRecord belongs_to :home_team, :class_name => 'Team' belongs_to :visitor_team, :class_name => 'Team' validates :home_team_score, numericality: { only_integer: true} validates :visitor_team_score, numericality: { only_integer: true} validates :season, numericality: { only_integer: true}...
# Run me with `rails runner db/data/20211207144100_delete_unwanted_budgets.rb` def find(organisation_name:, fund:, level:) organisation = Organisation.find_by(beis_organisation_reference: organisation_name) activities = Activity.where(organisation_id: organisation.id, level: level) if fund == "Newton" activ...