text
stringlengths
10
2.61M
class KeySessionsController < ApplicationController before_filter :log_out_user_if_logged_in def index unless current_key.nil? @folders = current_key.folders render 'index' else redirect_to keyauth_login_path, :error => "You need to log in with your email address and key to continue." ...
require 'spec_helper' describe ContentType do before(:each) do Site.any_instance.stubs(:create_default_pages!).returns(true) end context 'when validating' do it 'should have a valid factory' do content_type = FactoryGirl.build(:content_type) content_type.content_custom_fields.build :label ...
class ManageController < ApplicationController layout "manage" http_basic_authenticate_with( name: ENV["MANAGE_USERNAME"], password: ENV["MANAGE_PASSWORD"], if: -> { Rails.env.production? } ) end
class AddSampleIdAndCompanyIdToMedicineExternalRecords < ActiveRecord::Migration[5.0] def change add_column :medicine_external_records, :sample_id, :integer add_column :medicine_external_records, :company_id, :integer end end
require 'deck' require 'rspec' RSpec.describe Deck do subject(:deck) { Deck.new } describe '#initialize' do it 'should set @deck_pile to an empty array' do expect(deck.deck_pile).to eq([]) end end describe '#fill_deck' do before (:each) do deck.fill_deck end it 'sho...
class Node # tree @@data = [] # read file from command line argument and turn into array of array's File.open(gets.chomp,"r"){|fp| fp.each_line {|ln| @@data << ln.split(" ")}} # create a new node attr_accessor :val, :left, :rite def initialize(row=0, col=0) return nil if row == @@data.cou...
class Outpost::BlogsController < Outpost::ResourceController outpost_controller define_list do |l| l.default_order = "is_active" l.default_sort_mode = "desc" l.column :name l.column :slug l.column :teaser, header: "Tagline" l.column :is_active, header: "Active?", sortable: true, d...
class Paperboy def initialize(name) @name = name @experience = 0 @quota = 50.0 @earnings = 0.0 end def name @name end def experience @experience end def earnings @earnings end def quota @quota = 50 + @experience/2 end def deliver(start_address, end_address) @p...
require 'test_helper' class WrappedErrorSerializerTest < Minitest::Spec let(:cause) { StandardError.new("the message") } let(:wrapped) do SimpleJsonapi::Errors::WrappedError.new( cause, id: "the id", status: "the status", code: "the code", title: "the title", detail: "the d...
class CreateStockInfos < ActiveRecord::Migration[5.0] def change create_table :stock_infos do |t| t.string :market_code t.string :stock_code t.string :stock_name t.integer :current_rate_mny t.integer :buy_sell_unit t.boolean :nisa_target_flg t.integer :buy_lowest_mny ...
require 'rubygems' require 'bundler' require 'uri' require 'net/http' Bundler.require helpers do def protected! unless authorized? response['WWW-Authenticate'] = %(Basic realm="Restricted Area") throw(:halt, [401, "Not authorized\n"]) end end def authorized? @auth ||= Rack::Auth::Basi...
ActiveAdmin.register Restaurant do menu :label => "New Restaurant" menu :priority => 2 filter :name filter :city permit_params :id, :name, :address1, :address2, :city, :state, :zip, :phone, :hours, :email, :website, :description, :latitude, :longitude index do id_column column :name column ...
require 'simplecov' SimpleCov.start require 'minitest/autorun' require 'minitest/rg' require_relative 'todolist' class TodoListTest < MiniTest::Test def setup @todo1 = Todo.new("Buy milk") @todo2 = Todo.new("Clean room") @todo3 = Todo.new("Go to gym") @todos = [@todo1, @todo2, @todo3] @list =...
RSpec.describe Rocket::Rocket do let(:burn_rate) { 168240 } let(:avg_speed) { 1500 } let(:t1_speed) { 100 } let(:t5_speed) { 1499 } let(:engine) { double('engine') } describe 'calculate_rates_for(t)' do it 'calculates based burn rate based on engine speed' do expect(engine).to receive(:speed_at)...
require 'rails_helper' RSpec.describe QuestionsController, :type => :controller do let(:custom_field) {CustomField.create!(name: "Text")} let(:valid_attributes) { {name: "Test Survey", custom_field_id: custom_field.id } } let(:invalid_attributes) { {name: "", custom_field_id: custom_field.id} } context "L...
class Services < ActiveRecord::Migration[6.0] def change create_table :services do |t| t.string :name, null: false t.string :description t.decimal :price, default: 0 t.timestamps end create_table :services_students, id: false do |t| t.belongs_to :service t.belongs_to ...
# @author Matthew Rayner # @since 0.1 class FitBitStats < ActiveRecord::Base validates :steps, :floors, presence: { message: I18n.t('.fit_bt_stats.steps_floors_validation') } scope :ordered_by_age, -> { order(created_at: :desc) } end
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::Exploit::Remote::HttpClient include Msf::Exploit::CmdStager def initialize(info = {}) ...
class DeliveryRequest attr_reader :product, :order def initialize(product, order) @product = product @order = order end def type @product.type end def shipping_address @order.shipping_address end def customer @order.customer end def description @product.description end...
class IssuesController < ApplicationController # GET /issues # GET /issues.xml def index count_per_page = params[:count] page = params[:page] if count_per_page == nil count_per_page = 96 end if page == nil or page.to_i < 1 page = 1 offset = 0 else ...
class Member < ActiveRecord::Base include Reportable acts_as_user paginates_per 21 has_many :collaborations has_many :challenges, through: :collaborations has_many :entries def self.report_attributes [:id, :name, :email, :created_at] end def to_s return name unless name.blank? return ni...
class CreateClockTimes < ActiveRecord::Migration[6.0] def change create_table :clock_times do |t| t.DateTime :check_in_time t.DateTime :check_out_time t.string :status t.string :remark t.timestamps end end end
module MediaYoutubeProfile extend ActiveSupport::Concern included do Media.declare('youtube_profile', [/^https?:\/\/(www\.)?youtube\.com\/(user|channel)\/([^\/]+)/]) end def youtube_profile_direct_attributes %w( comment_count country description title published_at s...
module Ekidata class Import attr_accessor :model_name, :headers, :env_name def from_csv if ENV[@env_name].present? model = @model_name.classify.constantize rows = [] CSV.open(ENV[@env_name], 'r').each_with_index do |row, i| next if i == 0 rows << model....
require 'rails_helper' RSpec.describe SystemsController, type: :controller do fixtures :servers fixtures :details require 'yaml' describe 'GET #index' do context 'displays a list of all servers' do before do get :index end it { is_expected.to respond_with :ok } it { is_expec...
class RequestsController < ApplicationController before_filter :signed_in_check, only: [:new] before_filter :owner_check, only: [:update] # GET /requests # GET /requests.json def index @requests = Request.sort respond_to do |format| format.html # index.html.erb format.json { render json:...
class FontNotoSansTaiLe < Formula head "https://noto-website-2.storage.googleapis.com/pkgs/NotoSansTaiLe-unhinted.zip", verified: "noto-website-2.storage.googleapis.com/" desc "Noto Sans Tai Le" homepage "https://www.google.com/get/noto/#sans-tale" def install (share/"fonts").install "NotoSansTaiLe-Regular....
class AddArtsRoomToFurnitures < ActiveRecord::Migration[5.0] def change add_reference :furnitures, :arts_room, foreign_key: true end end
require 'rails_helper' describe Admin, type: :model do subject(:admin) { FactoryGirl.create :admin } it { is_expected.to be_audited } end
class AddPhotoToChevals < ActiveRecord::Migration[5.0] def change add_column :chevals, :photo, :string end end
class MotocicletasController < ApplicationController before_action :set_motocicleta, only: [:show, :edit, :update, :destroy] # GET /motocicletas # GET /motocicletas.json def index @motocicletas = Motocicleta.all end # GET /motocicletas/1 # GET /motocicletas/1.json def show end # GET /motocicl...
class BillsController < ApplicationController before_action :authenticate_user! before_action :admin_only def index @billsdue = Bill.all.order "id ASC" @grouped = Bill.all.group_by {} end end
require "ayi/version" require "ayi/strategy_manager" require "ayi/abstract_strategy" require "ayi/standard_strategy" Dir[File.expand_path('../ayi/strategies/**/*.rb', __FILE__)].each { |f| require f } module Ayi def self.cleanup!(filename, options={}) if strategy = StrategyManager.strategy_for_file_name(filenam...
class RpcController < ApplicationController skip_before_filter :verify_authenticity_token def execute result_json = if batch_request? params_requests.map do |rpc_request| RPCDispatcher.new(rpc_request).execute.to_json end.compact e...
require_relative 'spec_helper' require_relative 'ubuntu1204_options' describe 'rackspace_apache_php_test::override on Ubuntu 12.04' do before do stub_resources end context 'Apache 2.2' do cached(:chef_run) do ChefSpec::SoloRunner.new(UBUNTU1204_SERVICE_OPTS) do |node| node.set['apache']['v...
class GoodDog DOG_YEARS = 7 attr_accessor :name, :age def initialize(n, a) self.name = n self.age = a * DOG_YEARS end # overrides default .to_s instance method def to_s "This dog's name is #{name} and it is #{age} in dog years." end # @@number_of_dogs = 0 # def initialize # @@numb...
class PaymentMethod < ActiveRecord::Base has_and_belongs_to_many :profiles end
require 'rails_helper' RSpec.describe Comment, type: :model do let(:comment) {FactoryGirl.build(:comment)} describe "creation" do context "valid attributes" do it "should be valid" do expect(comment).to be_valid end end context "invalid attributes" do it "should not be...
class Super::BaseController < ApplicationController include Super::SuperConcern before_action :restricted_access layout "super" def restricted_access # redirect_to client_dashboard_index_path, alert: "Access Denied" if current_user.user_status == "pending" && current_user.has_role?(:client...
class RenameUserIdIdToUserIdInBooks < ActiveRecord::Migration def self.up rename_column :books, :user_id_id, :user_id end end
class CreateJobs < ActiveRecord::Migration def self.up create_table :jobs do |t| t.string :name t.text :description t.date :submit_date t.date :due_date t.string :entry_person t.string :acct_number t.string :requester t.string :department t.boolean :auth_sig ...
class AddOriginNameToMenuLinkCategories < ActiveRecord::Migration def self.up add_column :menu_link_categories, :origin_name, :string end def self.down remove_column :menu_link_categories, :origin_name end end
class E9Crm::CampaignsController < E9Crm::ResourcesController defaults :resource_class => Campaign include E9Rails::Controllers::Orderable helper :"e9_crm/deals" before_filter :redirect_new_to_subclass, :only => :new before_filter :redirect_for_default_from_time, :only => :reports prepend_before_filter ...
require 'spec_helper' describe Graphlient::Client do include_context 'Dummy Client' describe 'parse and execute' do context 'non-parameterized query' do let(:query) do client.parse do query do invoice(id: 10) do id feeInCents end ...
class Wiki < ApplicationRecord # after_initialize :set_default_privacy, :if => :new_record? belongs_to :user, optional: true def set_default_privacy self.private ||= false end end
require "chandler/refinements/color" module Chandler # Similar to Ruby's standard Logger, but automatically removes ANSI color # from the logged messages if stdout and stderr do not support it. # class Logger using Chandler::Refinements::Color attr_accessor :stderr, :stdout def initialize(stderr: ...
class RemoveDocumentGroups < ActiveRecord::Migration def up drop_table :document_groups remove_column :documents, :document_group_id end def down create_table :document_groups do |t| t.string :name t.references :department t.timestamps end change_table :documents do |t| ...
require "net/http" module Ruboty module Tryruby class Evaluator attr_reader :http, :request def initialize(command) @http = Net::HTTP.new('tryruby.org', 80) @request = Net::HTTP::Put.new('/levels/1/challenges/0') @request.set_form_data(cmd: command) end def evalu...
class CreateClients < ActiveRecord::Migration def up create_table :clients do |t| t.string :full_name, null: false t.text :address, null: false t.string :phone, null: false t.string :card_nufber t.timestamps null: false end add_index :clients, :full_name end def down ...
class Candidate < ActiveRecord::Base validates :bio, :presence => true #validates :user_id, :presence => true, :uniqueness => true validates :photo, :presence => true acts_as_voteable belongs_to :user has_attached_file :photo, { :styles => { :thumb => "120x120#", :medium => "300x300>" }, ...
describe Exporter::FieldContacts do include_context "exporter" describe "minimal field contact" do let!(:field_contact) { create(:field_contact) } it "exports" do export expect(record["fc_num"]).to eql("FC123") end end describe "maxmimum field contact" do let!(:field_contact_kirk)...
require "matrix" POSITION_MATCHER = /x=(?<x>-?\d+), y=(?<y>-?\d+)/ ROW ||= 2_000_000 SEARCH_SPACE ||= 4_000_000 FREQUENCY_KEY = 4_000_000 pairs = INPUT.split("\n").map do |line| line.scan(POSITION_MATCHER).map { |x, y| Vector[x.to_i, y.to_i] } end SENSORS = pairs.map { |sensor, beacon| [sensor, (sensor - beacon).s...
describe Injectable::DependenciesProxy, '#get' do let(:graph) do Injectable::DependenciesProxy.new( namespace: ns, graph: { dependency: dependency, dependent: dependent } ) end let(:ns) { double('Namespace') } let(:dependent) { double('Dep that depends on something', ...
class AddColumnsToFeedbacks < ActiveRecord::Migration def change add_column :feedbacks, :name, :string add_column :feedbacks, :contact_no, :string add_column :feedbacks, :published, :boolean, :default => false add_column :feedbacks, :deleted, :boolean, :default => false add_column :feedbacks, :arc...
ActiveAdmin.register About do # See permitted parameters documentation: # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters menu priority: 1 permit_params :paragraph form do |f| f.inputs do f.input :paragraph, as: :html_editor end f.button en...
require './lib/bike' class DockingStation attr_reader :station attr_reader :capacity DEFAULT_CAPACITY = 20 def initialize(capacity=DEFAULT_CAPACITY) @station = [] @capacity = capacity end def release_bike raise StopIteration if empty? @station.pop Bike.new end def dock_b...
ActiveAdmin.register Promotion do permit_params :nombre, :descripcion, :precio, :url, :fecha_publicacion, :hora_publicacion, :fecha_remocion, :hora_remocion, :status_pub, :imagen # See permitted parameters documentation: # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#settin...
class Portfolio < ActiveRecord::Base attr_accessible :name, :classification belongs_to :user has_many :trades, :dependent => :destroy validates :name, :presence => true, :uniqueness => {:scope => :user_id} validates :user_id, :presence => true validates :classification, :inclusion => %w(TRADING AFS HTM) def ...
# frozen_string_literal: true module Knuckles module Stages # The enhancer modifies rendered data using proc passed through options. # The enhancer stage is critical to customizing the final output. For # example, if staff should have confidential data that regular users can't # see you can enhance t...
class Post < ApplicationRecord has_many :post_attachments accepts_nested_attributes_for :post_attachments end
# Given this data structure write some code to return an array which contains only the hashes where all the integers are even. # get only the hashes where the value contains an array with only positive values arr = [{a: [1, 2, 3]}, {b: [2, 4, 6], c: [3, 6], d: [4]}, {e: [8], f: [6, 10]}] arr.select do |hash| hash.a...
# frozen_string_literal: true module Displayable LINE_WIDTH = 100 def display_clear system 'clear' puts end def display(something) something.class == Array ? display_array(something) : (puts something.center(LINE_WIDTH)) puts end def display_array(arr) arr.each do |line| puts l...
require "gtk3" #====== Classe représentant une page class Page < Gtk::Box attr_reader :hautPage, :btnRetour, :btnHome, :btnCompte, :enciennePage, :hautPage, :label , :couleur, :window #Initialise la page # @param monApp //l'application # @param sens //orientation de la page (vertical/horizont...
class LogsController < ApplicationController def index params[:per_page] ||= 30 # @logs = Log.all.order("created_at desc").limit(params[:per_page]) end end
# p004usodestring.rb # Definindo uma constante PI = 3.1416 puts PI puts "=================================================================================================" # Definindo uma variável local minha_string = 'Eu amo a minha cidade' puts minha_string puts "======================================================...
module Api module V1 class ReceivedPointsController < ApplicationController def create user = User.find(create_received_point_params[:user_id]) # 既にポイントのデータがある場合、そのデータを返す if !user.received_point.nil? render json: { status: 'SUCCESS. point is already exist', data: user.recei...
require 'spec_helper_acceptance' describe 'vision_monitoring' do context 'with defaults' do it 'idempotentlies run' do pp = <<-FILE class { 'vision_monitoring': path => '/tmp/monitoring' } FILE apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_cha...
# LAS Specifications # http://www.asprs.org/a/society/committees/standards/asprs_las_format_v10.pdf # http://www.asprs.org/a/society/committees/standards/asprs_las_format_v11.pdf # https://www.asprs.org/a/society/committees/standards/asprs_las_format_v12.pdf # http://www.asprs.org/a/society/committees/standards/asp...
require 'rails_helper' RSpec.describe "promotions/new", type: :view do before(:each) do assign(:promotion, Promotion.new( :company => nil, :category => nil, :user => nil, :nombre => "MyText", :descripcion => "MyText", :precio => 1.5, :url => "MyString", :status_pub...
FactoryGirl.define do factory :sermon_series do title "MyString" primaryTheme "MyString" secondaryTheme "MyString" end end
require 'rails_helper' RSpec.describe Login, type: :model do subject(:login) do Login.from_omniauth(omniauth_hash) end let(:email) { 'user@example.com' } let(:provider) { 'unknown' } let(:omniauth_hash) do { 'info' => { 'email' => email }, 'provider' => provider } en...
require 'rails_helper' RSpec.describe SolrDocument do subject(:solr_doc) { described_class.new(document_hash) } let(:date_created) { '2017-06-23' } let(:system_created) { '2017-06-23T12:34:56Z' } let(:date_modified) { '2017-06-23T13:34:56Z' } let(:document_hash) do { date_created_tesim: date_creat...
module FacilityWizardForm class RowsForm include Mapper ATTRS = [:facility_id, :room_id, :room_name, :facility_name, :is_complete, :has_sections, :wz_rows_count, :rows, :sections] attr_accessor(*ATTRS...
class UsersController < ApplicationController # Logged in users will be sent to profile page before_action :logged_in, only: [:new, :create] # Not logged in users will redirect to login page before_action :not_logged_in, only: [:show] def new @user = User.new end def create @user = User.new(user...
# frozen_string_literal: true require 'sample_agent_test_configuration' require 'utils/agent_runner' describe StatisticalArbitrageAgent do include_context 'use data_builder' let(:runner) { Utils::AgentRunner.new } before(:example) do runner.register_agent_file( 'sample_agents/src/statistical_arbi...
require 'spec_helper' describe VersionChange do context 'with existing data' do before do @user = User.create!(first_name: 'Ashrafuz', last_name: 'zaman') Auditlog::Data.stub(:current_user_id) { @user.id } @project = Project.create!(name: 'Stubbles') @start = WorkflowStatus.create!(titl...
# frozen_string_literal: true require 'set' require 'bolt/config' require 'bolt/inventory/group' require 'bolt/inventory/inventory' require 'bolt/target' require 'bolt/util' require 'bolt/plugin' require 'yaml' module Bolt class Inventory ENVIRONMENT_VAR = 'BOLT_INVENTORY' class ValidationError < Bolt::Err...
# frozen_string_literal: true # == Schema Information # # Table name: clicks # # id :bigint not null, primary key # browser :string not null # platform :string not null # created_at :datetime not null # updated_at :datetime not null # url_id :bigint ...
require_files('app/models/*.rb') require_files('app/helpers/*.rb') module SoManyFeeds module Application extend ActiveSupport::Concern include ApplicationHelper included do use Rack::Mole, rackamole_config if production? set :views, File.join(RACK_ROOT, 'app/views', to_var) set :h...
# /etc/nginx/conf.d/default.conf # https://www.digitalocean.com/community/tutorials/how-to-deploy-sinatra-based-ruby-web-applications-on-ubuntu-13 # todo change pids upstream app { # Path to Unicorn SOCK file, as defined previously server unix:/tmp/unicorn.tootors-api.sock fail_timeout=0; } server { li...
require 'spec_helper' describe ChatNoir do use_vcr_cassette describe 'error handling' do before do allow(ChatNoir) .to receive(:open) .and_raise('Zlib::DataError: incorrect header check') end it 'returns nil if error is raise' do expect(ChatNoir.copyright('')).to eq(nil) ...
require_relative '../group' module Sudoku describe Group do describe :initialize do it "can be created" do cells = Array.new(9, double) expect(Group.new(cells)).to be_a Group end it 'raises an error when not given correct amount of cells' do expect{ Group.new(Array.new(...
require 'test_helper' class RoutsControllerTest < ActionController::TestCase setup do @rout = routs(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:routs) end test "should get new" do get :new assert_response :success end test "s...
class Notification < Base attr_accessor :text, :time def initialize(params) super(params) @asset_type = "notification" end end
require "spec_helper" RSpec.describe Veeqo::Supplier do describe ".list" do it "retrieves the list of suppliers" do filters = { page: 1, page_size: 12 } stub_veeqo_supplier_list_api(filters) suppliers = Veeqo::Supplier.list(filters) expect(suppliers.count).to eq(1) expect(supplier...
class CreateQuesAndAns < ActiveRecord::Migration def change # execute "CREATE EXTENSION hstore" create_table :ques_and_ans do |t| t.text :question t.integer :answer_type t.text :answer_choices, default: {} t.text :right_answer, default: {} t.references :mock_test, index: true ...
require 'test_helper' class TrnProdPlanMastersControllerTest < ActionDispatch::IntegrationTest setup do @trn_prod_plan_master = trn_prod_plan_masters(:one) end test "should get index" do get trn_prod_plan_masters_url assert_response :success end test "should get new" do get new_trn_prod_pla...
class AddReadyToDonors < ActiveRecord::Migration def change add_column :donors, :ready, :datetime end end
require "downloader" require "pricing_calculator/letter_counter" module PricingType class Letter def call page = Downloader.new("http://time.com").body calculator = PricingCalculator::LetterCounter.new(page: page, letter: "a") calculator.call / 100 end end end
points = File.readlines("../inputs/day6.in").map { |x| x.strip.split(",").map { |n| n.to_i} } # find distance between two points def find_distance(a, b) x1, y1 = a x2, y2 = b (x1 - x2).abs + (y1 - y2).abs end # returns index of all points in input points closest to a def find_closest(a, points) # distance => ...
shared_examples_for "Trole Write API for multiple roles" do describe '#add_roles' do it "should be that after adding :admin role, he has that role" do lambda { user.add_roles(:admin) }.should raise_error # since it already has :user role and only allows one role! user.has_role?(:admin).should be_false...
require 'peep' describe Peep do describe '.all and Peep.create' do it 'returns a bookmarks list' do peep = Peep.create('I am a test peep') Peep.create('I am a 2nd test peep') Peep.create('I am yet 3rd test peep') peeps = Peep.all expect(peeps.first.id).to eq(peep.id) expect(...
# frozen_string_literal: true # Application Controller class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? before_action :set_current_user protected def configure_permitted_parameters devise_pa...
class ApplicantAddlAttachment < ActiveRecord::Base belongs_to :applicant_addl_attachment_field belongs_to :applicant attr_accessor :delete_attachment has_attached_file :attachment, :url => "/uploads/:class/:id/:attachment/:attachment_fullname?:timestamp", :path => "uploads/:class/:attachment/:...
class AuthedController < ApplicationController before_action :auth_user before_action :require_authed private def require_authed if !@current_user render json: {error: 'Please login, or pass a valid token header'}, status: 403 end end def auth_user @current_user = User.find_by(token: re...
# -*- coding: utf-8 -*- run 'gem install capybara database_cleaner cucumber cucumber-rails rspec-rails spork launchy' gem 'capybara', :group => :test gem 'database_cleaner', :group => :test gem 'cucumber', :group => :test gem 'cucumber-rails', :group => :test gem 'spork', :group => :test gem 'launchy', :group => :test...
require 'spec_helper' shared_examples("")do end describe SessionsController do describe "sessions#new (GET /login)" do before(:each) do get :new end it "has @user for form" do expect(assigns(:user)).to be_a_new(User) end it "redirects to new_session_path" do expect(response...
require_relative 'cursor' require 'colorize' class Display attr_accessor :board, :cursor def initialize(board) @board = board @cursor = Cursor.new([0,0], @board) end def render @board.each_row do |row, row_index| str = "" row.each_with_index do |piece, col_index| pos = [row_in...
class CreateElections < ActiveRecord::Migration[6.0] def change create_table :elections do |t| t.string :election_name t.string :election_type t.string :img_url t.text :election_desc t.date :election_end_date t.integer :number_of_votes t.references :user t.timestam...
module CopyMachine module ActiveRecordExtensions module Callbacks def with_disabled_callbacks remove_callbacks! yield resurrect_callbacks! end def remove_callbacks! override_callback_methods! callback_vars = self.instance_variables.select { |var| var =~ ...