text
stringlengths
10
2.61M
class AddForeignKeysToSubjects < ActiveRecord::Migration def change add_column :sections, :page_id, :integer add_column :pages, :subject_id, :integer add_index("pages","subject_id") add_index("pages","permalink") add_index("sections","page_id") end end
# 「memcacheに日本語文字列を格納すると文字化けしてしまう不具合」を修正するモンキーパッチ # 対象はappengine-apis-0.0.12 module AppEngine class Memcache def memcache_value(obj) case obj when Fixnum java.lang.Long.new(obj) when Float java.lang.Double.new(obj) when TrueClass, FalseClass java.lang.Boolean.new(...
class Article < ApplicationRecord nilify_blanks has_and_belongs_to_many :categories, :class_name=>'Category', :join_table => "articles_categories", :foreign_key => :article_id, :association_foreign_key => :category_id after_initialize :init def init self.active = true if self.active.nil? end end
class EntriesController < ApplicationController before_action :set_gig def index @entry = Entry.new @entries = @gig.entries.includes(:user) end def create @entry = @gig.entries.new(entry_params) if @entry.save redirect_to gig_entries_path(@gig), notice: "エントリーが送信されました" else @...
class RemoveReviewsFromSpots < ActiveRecord::Migration[5.2] def change remove_column :spots, :reviews end end
require_relative "tree" class KnightPathFinder attr_reader :root_node def initialize(pos) @@grid = [] (0..7).each do |n| arr = [] (0..7).each do |num| arr << [n, num] end @@grid << arr end @root_node = PolyTree...
class CreatePassports < ActiveRecord::Migration def change create_table :passports do |t| t.references :order, index: true, foreign_key: true t.string :number t.string :nationality t.string :gender t.date :issue_date t.date :finish_date t.string :name t.date :birhda...
Pod::Spec.new do |s| s.name = 'SwifterExtension' s.version = '1.0.0' s.summary = 'SwifterExtension is a extension swift for iOS app' s.description = 'SwifterExtension is a extension swift for iOS app. Extension some func String, Date, Color, Image, ViewController...' s.homep...
class MpagesController < ApplicationController def index @page = @project.pages.find_by_name(params[:pagename]) session[:renderable_preview_content] = @page.content content = @page.formatted_content_preview(action_view) respond_to do |format| format.json do headers["Content-...
require 'test_helper' require 'ostruct' class PaintedRabbit::Test < ActiveSupport::TestCase test "truth" do assert_kind_of Module, PaintedRabbit end test "it renders based on a templates class" do my_obj = OpenStruct.new(id: 1, name: 'Meg') SimpleRabbit = Class.new(PaintedRabbit::Base) do attri...
class ChangeColumnLocationId < ActiveRecord::Migration def change change_column :wildfires, :location_id, :integer end end
module DayBuilder class TimeTableEntry attr_reader :user, :start, :description attr_accessor :duration attr_writer :finish def initialize(params = {}) @duration = params[:duration] @finish = params[:finish] @description = params[:description] @start = params[:start] @tag...
class AccountsController < ApplicationController def show @user = User.find(params[:id]) @accounts = @user.accounts.order(account_name: :asc).all end def create id = User.find(params[:account][:user_id]) Account.create(account_params) redirect_to account_path(id) end def edit @ac...
Trestle.resource(:modifiers) do menu do item :modifieurs, icon: "fa fa-percent", group: :gestion_tarifaire end # Customize the table columns shown on the index view. # table do column :name column :description column :pourcentage_de_reduction, align: :center do |record| 100 - record.per...
require 'randumb' module Refinery module Testimonials class Testimonial < Refinery::Core::BaseModel self.table_name = "refinery_testimonials" translates :name, :quote, :teaser, :job_title, :website has_and_belongs_to_many :pages, :class_name => '::Refinery::Page', join_table: "refinery_pages_...
module Sensors class Desenselight < DesenseBase attributes :illuminance display_as :line_chart, group_by: :minute, attributes: [:illuminance] def illuminance @illuminance ||= values.illuminance.to_i # ??? / 1000.0 ??? end def attribute_units units = super units.merge({ illumina...
class FixRankingMv < ActiveRecord::Migration def up execute 'DROP MATERIALIZED VIEW IF EXISTS general_user_ranking_matview' execute <<-MATVIEW CREATE MATERIALIZED VIEW general_user_ranking_matview AS SELECT row_number() over (ORDER BY score DESC) as position, user_id, score as default_s...
class CreateRecords < ActiveRecord::Migration def self.up create_table :records do |t| t.string :name t.string :suffix t.string :record_type t.references :record_group t.integer :priority t.boolean :is_mandatory t.string :input_type t.timestamps end end def...
require 'rails_helper' require 'support/factory_girl' require 'support/disable_register_code' describe "/tickets/show.html.erb" do include TicketsHelper before(:each) do assign(:ticket, @ticket = create(:ticket)) end it "renders attributes in <p>" do render expect(rendered).to match /#{@ticket.ema...
# # MASTER MENU GAMESTATE # class MasterMenu < Chingu::GameState trait :timer def initialize super self.input = { [:up, :w] => :go_up, [:down, :s] => :go_down, [:right, :d] => :go_fullscreen, [:left, :a] => :leave_fullscreen, [:enter, :return, :space] => :choose_game } end def ...
class CommentsController < ApplicationController def new end def create @review = Review.find(params[:review_id]) @country = @review.country @comment = @review.comments.build(comment_params) @comment.user_id = current_user.id if @comment.save flash[:notice] = "Comment posted" else ...
class Users::IndexSerializer < ApplicationSerializer object_as :user attributes( :id, :email, :reset_password_sent_at, :remember_created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip, :last_sign_in_ip, :confirmed_at, :confirmation_sent_at...
require 'spec_helper' describe MakesController do describe "Go to index page" do it "returns http success" do visit makes_path response.should be_success end end describe "Go to new make page" do let!(:make) { Make.create! :name => 'Ford' } it "returns http success" do visit n...
# User User.create!(name: "Mysize公式", email: "info@mysize-sneakers.com", mysize_id: "mysize_official", password: "foobar", password_confirmation: "foobar", size: 26.5, remote_image_url: Faker::Avatar.image, content: "Mysi...
class ProfilesController < ApplicationController skip_before_action :authenticate, only: [:index, :show] # create arguments for zip and miles? def zips response = HTTParty.get("https://www.zipcodeapi.com/rest/#{ENV['API_KEY']}/radius.json/#{params[:zip]}/20/mile") # byebug response['zip_codes'].map {|e...
class Forecasts::ExcelRequestsController < ApplicationController before_filter :new_excel_request, only: [:new, :create] load_and_authorize_resource through: :current_forecast def index @forecast = Forecast.find(params[:forecast_id]) @excel_requests = ExcelRequest.where(forecast:@forecast) end de...
require 'test_helper' class EnrolledCoursesControllerTest < ActionController::TestCase setup do @enrolled_course = enrolled_courses(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:enrolled_courses) end test "should get new" do get :new ...
# based on https://github.com/camptocamp/puppet-openssl/blob/master/lib/puppet/provider/ssl_pkey/openssl.rb # Apache License, Version 2.0, January 2004 require 'pathname' require 'openssl' Puppet::Type.type(:dehydrated_key).provide(:openssl) do desc 'Manages private keys for dehydrated with OpenSSL' def self.dirn...
# frozen_string_literal: true require "characterize/object_set" module Characterize class FeatureSet def initialize @object_rules = {} end def add(object_name, **actions_hash) @object_rules[object_name] = ObjectSet.new(object_name, **actions_hash) end def dig(*args) @object_r...
# -*- coding: utf-8 -*- module FtpUtils module DirUtils module_function def delete_all(path, ignore_self = nil) if FileTest.file?(path) File.delete(path) return end Dir.glob(File.join(path, '*')).sort.each do |tgt| next if tgt =~ /^\.+$/ delete_all(tgt) ...
# 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...
# frozen_string_literal: true require 'application_system_test_case' module Courses class ShowTest < ApplicationSystemTestCase def setup @teacher = teachers(:snape) @course = courses(:potions) sign_in @teacher end test 'guest user can see a course' do sign_out @teacher vis...
class FoodItemSerializer < ActiveModel::Serializer attributes :id, :name, :brand, :quantity, :section, :shelf def shelf section = object.section shelf = Shelf.find_by_id(section.shelf_id) ShelfSerializer.new(shelf) end end
Gem::Specification.new do |s| s.platform = Gem::Platform.new(['x86_64', 'darwin']) # at least Mountain Lion s.name = 'dns' s.version = '0.0.5' s.date = '2013-10-26' s.summary = "A gem for configuring DNS on OS X" s.description = "A gem for configuring DNS on OS X" s.required_ruby...
class Sermon < ApplicationRecord belongs_to :series validates :series_id, presence: true validates :title, presence: true, length: {minimum: 2, maximum: 100} validates :speaker, presence: true, length: {minimum: 2, maximum: 100} validates :sermondate, presence: true validates :desc, presence: true, length: {minim...
class HalalpostsController < ApplicationController before_action :find_halalpost, only:[:show, :edit, :destroy] def index @halalposts = Halalpost.all.order("created_at DESC") end def new @halalpost = Halalpost.new end def show end def create @halalpost = Halalpost.new(halalposts_params)...
class Tweet < ApplicationRecord #TODO: validates belongs_to :user has_many :likes has_many :like_users, through: :likes, source: :user end
# Written by Samuel Burns Cohen # Jan 24, 2019 # # Tokenizer.rb # # This file defines the Tokenizer class require_relative '../Components/Token' require_relative '../Components/FileRef' class Tokenizer public def initialize(text, error_handler) @text, @error_handler = text, error_handler @chunk_...
class GoogleDirectionsService def initialize(origin, destination) @origin = origin @destination = destination end def directions response = conn.get('directions/json') do |req| req.params['origin'] = origin req.params['destination'] = destination req.params['language'] = 'en' ...
require 'securerandom' class ApiKey < ActiveRecord::Base belongs_to :organization rolify def generate_key self.key = SecureRandom.uuid end def expire! update_attributes(expired: true) end end
class UsersController < ApplicationController before_action :require_user, only: [:index] def index @users = User.all end private def user_params params.require(:user).permit(:username, :email, :password, :password_confirmation) end end
require 'rails_helper' require "models/concerns/serializable" RSpec.describe User, type: :model do subject { build_stubbed(:user) } describe "Validations" do it "has a valid factory" do expect(subject).to be_valid end it { should validate_presence_of(:email) } # it { should validate_presenc...
class TweetMailer < ApplicationMailer def tweet_mail(tweet) @tweet = tweet mail to: tweet.user.email , subject: "ツイート確認メール" end end
class BreedersController < ApplicationController before_action :set_breeder, only: [:show, :edit, :update, :destroy] # GET /breeders # GET /breeders.json def index @breeders = Breeder.all end # GET /breeders/1 # GET /breeders/1.json def show end # GET /breeders/new def new @breeder = Br...
class Addphototocontracts < ActiveRecord::Migration[5.1] def change add_column :contrats, :contratpdf, :string end end
require 'rails_helper' RSpec.describe "the Project model" do before(:all) do @project = Project.create(title: "Test Project 1", description: "this is a test") end it "creates 100 child squares after it a new project is created" do expect(@project.squares.count).to eq 100 end it "always makes the center sq...
require 'spec_helper' describe User::Registration do describe 'visitor' do subject { User.create_visitor! } it { should_not be_registered } it { should be_valid } end end
class AddImageableToCars < ActiveRecord::Migration[6.0] def change add_reference :cars, :imageable, polymorphic: true end end
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable validates_presence_of :first_name, :last_name # has...
# frozen_string_literal: true module ScratchPad module_function def recorded @recorded ||= [] end def <<(value) recorded << value end def clear @recorded = [] end end
class RunLengthEncoding def self.encode(input) input .chars .chunk_while { |i, j| i == j } .map { |chunk| [chunk.size, chunk[-1]] } .flat_map { |chunk| chunk.drop_while { |c| c == 1 } } .join end def self.decode(input) input .chars .chunk_while { |i, _| i.match?(...
# A shared context to `include` the module under test. # # This is useful for testing Puppet classes which have a dependency on their # parent class. For example, in order to test the `phabricator::config` class # using `rspec-puppet`, we must first include the parent (`phabricator`) class # in order to define the nece...
# frozen_string_literal: true # == Schema Information # # Table name: problem_reports # # id :bigint(8) not null, primary key # created_at :datetime not null # updated_at :datetime not null # computer_number :string not null # description ...
require 'io/console' require 'zabbix/client' def get_config token = ENV['ZABBIX_API_TOKEN'] username = ENV['ZABBIX_API_USERNAME'] password = ENV['ZABBIX_API_PASSWORD'] unless username print "Enter username: " password = STDIN.noecho(&:gets).chomp end unless password print "Enter password for #...
class ClientSegment < ActiveRecord::Base audited belongs_to :client has_many :words_keys, dependent: :destroy accepts_nested_attributes_for :words_keys, allow_destroy: true, :reject_if => proc { |attrs| attrs[:word].blank? } end
module ApplicationHelper def city_name @city_name ||= Venue.new.send(:city) end def alt_cities { 'New York' => 'nyc', 'Chicago' => 'chicago' }.reject { |_, v| v == schema } end def city_url(sub) %W{ http://#{sub} #{request.subdomains.reject { |s| s == schema }.join('.')} ...
LookupStrategies::Boston = Struct.new(:title, :author) do def find copies.map do |copy| copy[:location] = normalize_location_name(copy[:location]) ScrapedBook.new(copy.slice(*ScrapedBook::ATTRIBUTES)) end end def copies LookupStrategies::Lyeberry.new('boston').copies(title, author) end ...
# $Id: test_cipher.rb,v 1d557f2f8b62 2013/03/05 14:28:17 roberto $ require 'test/unit' require 'yaml' require 'key' require 'cipher' module TestCipher # == TestSimpleCipher # class TestSimpleCipher < Test::Unit::TestCase # === setup # def setup @cipher = Cipher::SimpleCipher.new end # -- setup ...
# frozen_string_literal: true require 'expedia/api/client' RSpec.describe Expedia::API::Client do it 'should have the expected attributes' do client = Expedia::API::Client.new 'SampleUserName', 'SamplePassword' expect(client.eqc_username).to eq('SampleUserName') expect(client.eqc_password).to eq('Sample...
class User < ApplicationRecord has_many :posts, dependent: :destroy validates :name, presence: true validates :email, presence: true, format: /\A[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\z/i scope :posts_count_more_than, ->(count) do joins(:posts).group('users.id').having('count(posts.id) > ?', count) if coun...
class AddApplicationIdToRequests < ActiveRecord::Migration def change add_column :tr8n_requests, :application_id, :integer add_index :tr8n_requests, [:type, :application_id, :email], :name => :tr8n_req_t_a_e end end
require 'gosu' require_relative '../utils.rb' class TestIntersection < Gosu::Window def initialize super 500,500 #segment1 @x1 = 200 @y1 = 300 @x2 = 350 @y2 = 250 #segment2 @x3 = 0 @y3 = 0 @x4 = 0 @y4 = 0 #rectangle 1 ...
class Library attr_accessor :items, :auctions def initialize @items = {} @auctions = {} end def add(object) if object.class == Item @items[object.name] = object elsif object.class == Auction @auctions[object.item.name] = object else nil end end def query_item...
class Gossip < ApplicationRecord belongs_to :user, optional: true has_many :fake_tags has_many :tag, through: :fake_tags end
class CreateSubscriptions < ActiveRecord::Migration def change create_table :subscriptions do |t| t.integer :user_id, null: false t.integer :payment_account_id, null: false t.integer :charity_id, null: false t.string :processor_subscription_id ...
# frozen_string_literal: true Zeitwerk::Loader.new.tap do |loader| loader.tag = File.basename(__FILE__, ".rb") loader.inflector = Zeitwerk::GemInflector.new(__FILE__) loader.push_dir(File.expand_path('..', __dir__)) loader.setup end module Pragma module Filter class Error < StandardError; end # Your...
class AddAvatarToCentre < ActiveRecord::Migration[5.2] def change add_column :centres, :avatar, :string end end
module TacoBellHelper def sample_names ['Bean Burrito', 'Nachos Supreme', 'Crunchy Taco'] end def sample_categories ['Burritos', 'Nachos', 'Tacos'] end def sample_items sample_names.zip(sample_categories) .map { |(i, j)| OpenStruct.new(name: i, categories: [j]) } end def sam...
module Sluggable extend ActiveSupport::Concern included do before_validation :set_default_slug end def set_default_slug return if slug.present? self.slug = Russian .translit(title) .tr(' ', '-') .gsub(/[^\x00-\x7F]+/, '') .gsub(/[^\w_ \-]+/i, '') .gsub(/[ \-]+/i, '-') ...
RSpec.describe Mutant::Env do context '#kill' do let(:object) do described_class.new( config: config, actor_env: Mutant::Actor::Env.new(Thread), cache: Mutant::Cache.new, selector: selector, subjects: [], mutations: ...
#!/usr/bin/env ruby require 'sidekiq' require 'sidekiq/api' require 'choice' require_relative '../lib/config/app' require_relative '../lib/config/redis' require_relative '../lib/jobs/scrape' Choice.options do option :input, required: true do short '-i' long '--input=FILE' desc 'required: file with list...
# # Cookbook Name:: databox # Recipe:: default # # if node["databox"]["databases"]["mysql"].any? include_recipe "databox::mysql" end if node["databox"]["databases"]["postgresql"].any? include_recipe "databox::postgresql" end
# require 'pry' class Anagram attr_accessor :word def initialize(word) @word = word end def match(array) # anagrams = [] # array.each do |x| # if word.split("").sort == x.split("").sort # anagrams << x # end # end # anagrams array.reject {|x| word.split("").sort !...
class Oystercard attr_reader :balance DEFAULT_BALANCE = 0 MAX_AMOUNT = 90 MIN_JOURNEY_COST = 1 def initialize(balance = DEFAULT_BALANCE) @balance = balance end def top_up(amount) raise "Cannot top up: your card reached the limit of GBP#{MAX_AMOUNT}" if @balance + amount > MAX_AMOUNT @balanc...
json.array!(@phonemes) do |phoneme| json.extract! phoneme, :id, :base, :actual, :diacritic, :sequence, :speaker_id json.url phoneme_url(phoneme, format: :json) end
class CompraProducto < ApplicationRecord belongs_to :compra belongs_to :producto end
# -*- coding: utf-8 -*- class IndexController < ApplicationController before_filter :login_required def index if current_user.is_admin? return redirect_to "/admin" end redirect_to '/dashboard' end def dashboard # 教师和学生的工作台页面 end def user_complete_search # user_ids = User.comp...
class SettingsController < ApplicationController before_action :authenticate_user before_action :authorize_user def index @password_length = Setting.find_by(key: :password_length) @password_uppercase = Setting.find_by(key: :password_uppercase_letter) @password_downcase = Setting.find_by(key: :passwor...
class MakeDocsNameFieldThePrimaryKey < ActiveRecord::Migration def self.up # there is no way I know of yet to make a non-numeric primary key with # migrations, so I had to do it directly on the docs table with mysql-admin. # Hoping that composite-primary-keys will take care of that. create_table :doc...
# frozen_string_literal: true module Sleet class Repo REMOTE_BRANCH_REGEX = %r{^([^\/.]+)\/(.+)}.freeze CURRENT_BRANCH_REGEX = %r{^refs\/heads\/}.freeze GITHUB_MATCH_REGEX = %r{github.com[:\/](.+)\/(.+)\.git}.freeze def self.from_config(config) new( repo: Rugged::Repository.new(config....
class ApplicationController < ActionController::Base protect_from_forgery layout :layout_for_signin protected def after_sign_in_path_for(resource) registrations_path(status: 'confirmed') end private def layout_for_signin if devise_controller? "auth" else "application" end e...
# Alan created the following code to keep track of items for a shopping cart application he's writing: class InvoiceEntry attr_reader :quantity, :product_name def initialize(product_name, number_purchased) @quantity = number_purchased @product_name = product_name end def update_quantity(updated_count...
require "matrix" class Bingo::Results WIN = "WIN" LOST = "LOST" def self.check(board_id, numbers) board = Board.find(board_id) m = Matrix.columns(board.strips) (0..3).each do |i| row_numbers = m.row(0).to_a.compact return WIN if (row_numbers - numbers.map(&:to_i)).empty? end LOST...
class Team attr_accessor :name, :motto, :members @@all = [] def initialize(name, motto) @@all << self @members = [] @name = name @motto = motto end def add_hero(hero) @members << hero end def self.all @@all end end
# What method could you use to find out if a Hash contains a specific value # in it? Write a program to demonstrate this use. silly_names = { a: "Cheese Pants", b: "Quirkle", c: "CrazyPants McGee" } if silly_names.has_value? ('Cheese Pants') puts "That is a great name." else puts "I cant find that name."...
class ScriptBeatsController < ApplicationController before_action :set_script_beat, only: [:show, :edit, :update, :destroy] # GET /script_beats # GET /script_beats.json def index limit = params[:limit_to] ? Integer(params[:limit_to]) : ScriptBeat.count offset = params[:skip_to] ? Integer(params...
# frozen_string_literal: true require_relative '../options' module StringCheese module Helpers # Provides methods to determine whether or not options exist in the # current receiver. The options checked are #options and # #data_repository.options module OptionsExist def current_options ...
# frozen_string_literal: true require "test_helper" class Rack::SessionCounterTest < Minitest::Test include Rack::Test::Methods def get_call_count(type) get "/_auth/stats" data = JSON.parse(last_response.body) data["#{type}_calls"] end def teardown if File.exist? statsfile_path File.de...
module AddressesHelper require 'tel_formatter' def postal_code(postal_code) "〒#{postal_code.to_s.insert(3, "-")}" end def building(building) building.present? ? (building) : ("建物名は登録されていません") end def phone_number(phone_number) return "電話番号は登録されていません" if phone_number.blank? TelFormatter.fo...
# frozen_string_literal: true module GeoPattern module StructureGenerators class ConcentricCirclesGenerator < BaseGenerator private attr_reader :scale, :ring_size, :stroke_width def after_initialize @scale = hex_val(0, 1) @ring_size = map(scale, 0, 15, 10, 60) @stroke_...
# frozen_string_literal: true require "beyond_api/utils" module BeyondApi class Categories < Base include BeyondApi::Utils # # A +GET+ request is used to list all available categories in a paged manner. # # $ curl 'https://api-shop.beyondshop.cloud/api/categories' -i -X GET \ # -H '...
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" VAGRANT_DISABLE_VBOXSYMLINKCREATE = "1" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Global setttings # Use same SSH key for each machine config.vm.provider "virtualbox" config.vm.provider "virtualbox" do | vm | vm.customiz...
require 'colorize' def rainbow!(string) string .each_line .zip(%i(red yellow green magenta blue cyan)) .map { |line, color| line.colorize(color) } .join end section "CLI Ninja\nTMux, SSH, Vim & friends" do block <<-EOS Why GUI? - easy (low learning curve) - no manuals needed (at least...
class CategoriesController < ApplicationController before_action :authenticate_customer!, only: [:new, :create] def new @category = Category.new end def create @category = Category.find_by(create_category_params) if (@category) flash[:alert] = "Category exists" redirect_to new_category...
# frozen_string_literal: true require 'json' require 'rbpay/xendit/errors' require_relative 'base' module Xendit class VirtualAccount < Base def create(params) response = @client.post('callback_virtual_accounts', params) handle_response(response) end def available_banks response = @cl...
class AddVcfffileorigToIsolates < ActiveRecord::Migration def change add_column :isolates, :vcffileorig, :string end end
require 'pathname' module Git class Diff < Struct.new(:files) LINE = /\n([ \-\+])(.*)/ HUNK = /\n(@@ -(\d+),(\d+) \+(\d+),(\d+) @@(.*))((#{LINE.source})+)/ FILE = /^(diff .+)\n(index .+)\n(--- (.+))\n(\+\+\+ (.+))((#{HUNK.source})+)/ DEV_NULL = '/dev/null' class File < Struct.new(:diff_line, ...
class Event < ApplicationRecord has_many :character_events, inverse_of: :event has_many :characters, through: :character_events, inverse_of: :events belongs_to :chapter, inverse_of: :events scope :newest, -> { order(weekend: :desc) } scope :oldest, -> { order(weekend: :asc) } validates :campaign, presenc...
# == Schema Information # # Table name: articles # # id :integer not null, primary key # title :string(255) # body :text # created_at :datetime not null # updated_at :datetime not null # image_file_name :string(255) # image_co...
class ChangeColumnDefaultToWastings < ActiveRecord::Migration[6.0] def change change_column_default :wastings, :price, from: nil, to: "0" end end