text
stringlengths
10
2.61M
class CreateSquares < ActiveRecord::Migration def change create_table :squares do |t| t.float :length t.float :width t.float :thickness t.integer :pieces t.integer :item_id t.date :order_date t.date :delivery_date t.string :material t.timestamps end end...
class HealthCheckPagesController < ApplicationController def preview_pdf_page(template_name, output_file_name) respond_to do |format| format.pdf do # 詳細画面のHTMLを取得 html = render_to_string template: "health_check_pages/#{template_name}" # PDFKitを作成 pdf = PDFKit.new(html, enco...
# 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 Incident::ProhibitionAndResponsibility < ApplicationRecord self.table_name = "prohibition_and_responsibilities" # Validações validates :item, presence: true # Associações has_and_belongs_to_many :incidents end
class FontNovaSlim < Formula head "https://github.com/google/fonts/raw/main/ofl/novaslim/NovaSlim.ttf", verified: "github.com/google/fonts/" desc "Nova Slim" homepage "https://fonts.google.com/specimen/Nova+Slim" def install (share/"fonts").install "NovaSlim.ttf" end test do end end
class User < ActiveRecord::Base has_many :services # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omnia...
class AlterProjectsTable < ActiveRecord::Migration def change remove_column :projects, :category add_column :projects, :secondary_acct_number, :string change_column :work_orders, :work_order_number, :string end end
class ProjectsController < ApplicationController before_action :find_project, only: [:show, :edit, :destroy, :update] before_action :authenticate_user!, except: [:index, :show] def index @projects = Project.all.order("updated_at desc").paginate(page: params[:page], per_page: 9) end def new @project = Project...
RailsAdmin.config do |config| ### Popular gems integration ## == Devise == # config.authenticate_with do # warden.authenticate! scope: :user # end # config.current_user_method(&:current_user) config.authorize_with do if current_user.nil? redirect_to main_app.new_user_session_path else ...
require 'minitest/autorun' require 'minitest/pride' require './lib/guess' require './lib/card' require './lib/guess' require './lib/round' class RoundTest < Minitest::Test def setup @card_1 = Card.new("3","Hearts") @card_2 = Card.new("4", "Clubs") @deck = Deck.new([@card_1, @card_2]) @round = Round....
module Quota extend ActiveSupport::Concern module ClassMethods def quota(scope:, limit:) unless method_defined?(:validate_quota) include InstanceMethods validate :validate_quota class_attribute :quotas self.quotas = [] end self.quotas << { scope: scope, limi...
class Rent < ApplicationRecord belongs_to :user validates :userName, presence: true, length: { minimum: 4 } validates :model, presence: true validates :pickUpDate, presence: true validates :pickUpTime, presence: true validates :returnDate, presence: true validates :returnTime, presence: true validates :...
describe 'TopLanguageController' do describe "GET '/'" do it 'should render page' do get '/' expect(last_response.status).to eq(200) end end describe "GET '/versality'" do it 'should render page' do VCR.use_cassette('versality') do get '/versality' end expect(la...
Gem::Specification.new do |s| s.name = 'ruby-test' s.version = '0.1.10' s.licenses = ['MIT'] s.summary = "This is an example!" s.description = "Much longer explanation of the example!" s.authors = ["Ruby Coder"] s.email = 'rubycoder@example.com' s.files ...
class Diamond def self.make_diamond(letter) return "A\n" if letter == 'A' range = ('B'..letter).to_a width = find_width(range.size) lines = generate_lines(range) lines.map { |line| line.center(width) }.join("\n") + "\n" end class << self private def find_width(num) width = 1...
require 'test_helper' require 'car_production_line' require 'engine_installation_state' require 'hood_installation_state' require 'wheels_installation_state' require 'exceptions/illegal_jump' describe CarProductionLine do let(:production_line) { CarProductionLine.new } it "starts with the engine" do productio...
# encoding: utf-8 class JobOffersController < ApplicationController load_and_authorize_resource def index @job_offers = JobOffer.with_state(:published).paginate(:page => params[:page], :order => 'created_at DESC', :per_page => 15, :include => [:user, :job_type]) end def show @job_offer = JobOffer.find...
class CommentsController < ApplicationController load_and_authorize_resource before_action :authenticate_user!, only: [:new, :create, :edit, :update] def create @comment = Comment.create(comment_params) @comment.user_id = current_user.id @comment.save redirect_to :back end def destroy ...
class RedisHistory def initialize(asins, type, max_age) @asins = asins @type = type @max_age = max_age.to_i @minimum_age = 60.days.ago end def all result = {} redis.pipelined do @asins.each do |asin| history = redis.hgetall asin # history = Rails.cache.fetch(asin, ex...
require 'rails_helper' RSpec.describe Referrer::Session, type: :model do before :each do @user = Referrer::User.create! end before :each, with_sources: true do @session = @user.sessions.create!(active_from: 10.days.ago, active_until: 10.days.since) @source_0 = @session.sources.create!(referrer: 'htt...
class User attr_reader :fullname, :email, :contacts def initialize(fullname, email, contacts) @fullname, @email, @contacts = fullname, email, contacts end end
class SourcesController < ApplicationController require 'yaml' def index # Set options for viewing. @opt = {} @opt['show_only_flagged'] = 1 if params['show_only_flagged'] # Find all data except for the advisory details, as that contains a lot of # data sometimes. Potentially we could reverse ...
class Position QUARTERBACK = 'qb' HALFBACK = 'hb' WIDE_RECEIVER = 'wr' FULLBACK = 'fb' TIGHT_END = 'te' RIGHT_TACKLE = 'rt' RIGHT_GUARD = 'rg' CENTER = 'c' LEFT_GUARD = 'lg' ...
class Api::EventsController < ApplicationController before_action :authenticate_user! def index if params['artist_id'] artist = Artist.find_by(username: params['artist_id']) events = artist.events if params['appointments'] events = events + artist.appointments end ...
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 include HomeHelper def redirect_back redirect_to (request.referer.present? ? :back : :root) end def redire...
# This is the target class class Compound protected attr_accessor :compound_name, :boiling_point, :melting_point, :molecular_weight, :molecular_formula public def initialize(name) @compound_name = name end def display puts "\nCompound #{@compound_name} -----" end end
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'csv' require 'optparse' # Position of fields in the CSV output by CSVKeychain URL = 0 USERNAME = 1 PASSWORD = 2 TITLE = 3 NOTES = 4 CREATED = 5 MODIFIED = 6 KIND = 7 TYPE = 8 DOMAIN = 9 AUTHTYPE = 10 CLASS = 11 CREATOR = 12 options = {} O...
class RenameCompanyContactToContact < ActiveRecord::Migration def change rename_column :notifications, :company_contact_id, :contact_id rename_table :company_contacts, :contacts end end
unless $LOAD_PATH.include?("lib") $LOAD_PATH.unshift("lib") end unless $LOAD_PATH.include?("test") $LOAD_PATH.unshift("test") end require 'madeleine' require 'stringio' class CommandLogTest < Minitest::Test class ExampleCommand attr :value def initialize(value) @value = value end def e...
require "rails_helper" RSpec.describe "Address Lookup" do # To run against the real service .. not VCR or stubbed, # need to have the ea address facade service running either locally : # # java -jar target/ea-addressfacade-0.1.jar server config.json # # Or configured externally via apps secrets.yml (see ...
require 'cucumber/formatter/console' require 'cucumber/formatter/ansicolor' require 'cucumber/formatter/io' require 'ruby-progressbar' module Cucumber module Formatter class CuckeBar include Io include Console attr_reader :runtime def initialize(runtime, path_or_io, options) ...
class Favorite < ApplicationRecord belongs_to :book belongs_to :user validates :user_id, {presence: true} validates :book_id, {presence: true} end
require 'spec_helper' describe Myaccount::CreditCardsController do render_views before(:each) do activate_authlogic @user = create(:user) login_as(@user) stub_redirect_to_welcome charge_mock = mock() charge_mock.stubs(:customer_token).returns('fakeTOKEN') Stripe::Charge.stubs(:creat...
class Buyer < ApplicationRecord has_many :customer_mobiles end
module Cybertail def self.config @config ||= create_config end private_class_method def self.create_config attributes = load_config Struct.new('Config', *attributes.keys, keyword_init: true) Struct::Config.new(attributes) end private_class_method def self.load_config credentials = Rails....
# frozen_string_literal: true module Api::V1::User::Tokens class CreateAction < ::Api::V1::BaseAction include ::TransactionContext[:request] AUTH_TOKEN_LIFETIME = 5.days private_constant :AUTH_TOKEN_LIFETIME try :deserialize, with: 'params.deserialize', catch: JSONAPI::Parser::InvalidDocument ...
class Qualification < ActiveRecord::Base belongs_to :user belongs_to :agency end
require 'rim/module_helper' require 'rim/rim_info' require 'rim/file_helper' require 'rim/dirty_check' require 'tempfile' require 'pathname' module RIM class SyncModuleHelper < ModuleHelper def initialize(dest_root, workspace_root, module_info, logger) super(workspace_root, module_info, logger) @dest...
class CreateDocuments < ActiveRecord::Migration[5.0] def change create_table :documents, id: :uuid do |t| t.uuid :employee_id, null: false t.uuid :document_template_id, null: false t.string :name, null: false t.text :body, null: false t.datetime :deleted_at t.timestamps end...
require "spec_helper" RSpec.describe "Using the app template" do before(:all) { run_flask } it "should create the temp directory" do expect(File).to exist("tmp/dummy_app") end it "should use the current ruby version" do gemfile_file = IO.read "#{project_path}/Gemfile" expect(gemfile_file).to matc...
require 'spec_helper' feature 'User switching', :acceptance do let(:tasks) { find('[widget=tasks]') } def switch_user(user_id) user_id = user_id.to_s users = find('[widget=user-selector]') users.find('[control=current-user]').tap do |user_control| unless user_control.value == user_id us...
# frozen_string_literal: true module Kafka class ZstdCodec def codec_id 4 end def produce_api_min_version 7 end def load require "zstd-ruby" rescue LoadError raise LoadError, "using zstd compression requires adding a dependency on the `zstd-ruby` gem to your Gemfile....
class Song < ApplicationRecord belongs_to :album validates :name, presence: true validates :spotify_url, presence: true validates :spotify_id, presence: true class << self def random_song_by_genre(genre_name) artist = Artist.where( "array_to_string(genres, ',') ILIKE ?", "%#{genre_name}%" ...
#!/usr/bin/ruby # from https://devcentral.f5.com/wiki/iControl.SSLKeyAndCSRCreator.ashx require "rubygems" require "f5-icontrol" require "getoptlong" options = GetoptLong.new( [ "--bigip-address", "-b", GetoptLong::REQUIRED_ARGUMENT ], [ "--bigip-user", "-u", GetoptLong::REQUIRED_ARGUMENT ], [ "--...
FactoryGirl.define do factory :author do first_name "Alan" last_name "Turing" homepage "http://wikipedia.de/alan_turing" end factory :author2, class: Author do first_name "Peter" last_name "Plagiarist" homepage "http://wikipedia.de/alan_turing" end end
class AddSexToUsers < ActiveRecord::Migration def change add_column :users, :sex, :integer, default: 1 change_column :users, :image, :string end end
class OrderItem < ActiveRecord::Base belongs_to :order has_attached_file :image, styles: { small: "120x120!" } # Validate the attached image is image/jpg, image/png, etc validates_attachment :image, content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"] } end
require "#{File.dirname(__FILE__)}/spec_helper" describe RelationType do it "should require a name" do @relation_type = RelationType.new @relation_type.should_not be_valid @relation_type.errors[:name].should == "can't be blank" end end
# A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. # A number n is called deficient if the sum of its proper divisors is less than n and it i...
#!/urs/bin/ruby def bubble_sort(arr) begin swapped = false for j in 0...arr.length-1 if arr[j] > arr[j+1] arr[j], arr[j+1] = [arr[j+1], arr[j]] swapped = true end end end while swapped arr end p bubble_sort([4,3,78,2,0,2])
require 'rails_helper' RSpec.describe 'Authentication', type: :feature do describe 'registration' do subject :register do visit root_path within('.navbar') { click_on 'Register' } fill_in 'Email', with: user_attributes[:email] fill_in 'Password', with: user_attributes[:password], match: ...
require 'rufus-scheduler' require 'active_support' require 'active_support/core_ext' class CronJobs attr_reader :helper, :request_helper, :scheduler, :waiting_requests def initialize(helper, request_helper, scheduler, waiting_requests, helper_point_checker, db_name) @helper = helper @request_helper = requ...
require 'spec_helper' describe 'swift::client' do describe "with default parameters" do it { should contain_package('swiftclient').with_ensure('present') } end describe "with specified version" do let :params do {:ensure => '2.0.2-1'} end it { should contain_package('swiftclient').with_e...
class HomeController < ApplicationController def index @urls = Image.all end end
require 'spec_helper' describe TumblrDataController do def valid_attributes {} end def valid_session {} end describe "GET index" do it "assigns all tumblr_data as @tumblr_data" do tumblr_datum = TumblrDatum.create! valid_attributes get :index, {}, valid_session assigns(:tumbl...
class Api::V1::CallsController < Api::V1::BaseController def show @call = Call.find(params[:id]) end end
#!/usr/bin/env ruby require 'nmap/program' require 'nmap/xml' require 'mac_vendor' require 'samanage' token = ARGV[0] datacenter = ARGV[1] @samanage = Samanage::Api.new(token: token, datacenter: datacenter) SCAN_XML = "nmap-data#{DateTime.now.strftime("%H-%M-%b-%d-%y")}.xml" LOGFILE = "Assets Not Imported #{DateTime...
require 'spec_helper' describe JournalArticle do before(:each) do # This gives you a test article object that can be used in any of the tests @article = JournalArticle.new end it "should have the specified datastreams" do # Check for descMetadata datastream with MODS in it @article.datastreams....
$:.unshift "../lib" require 'sqlite3/database' require 'test/unit' require 'mocks' class TC_Database_Init < Test::Unit::TestCase def test_new # any_instance fails here... driver = Driver.new driver.expects(:open).once.with('foo.db', false).returns([0, 'cookie']) Driver.stubs(:new).returns(driver) ...
require 'date' Gem::Specification.new do |s| s.name = "puppet-community-mvp" s.version = "0.0.8" s.date = Date.today.to_s s.summary = "Generate some stats about the Puppet Community." s.license = 'Apache-2.0' s.email = "ben.ford@puppet.com...
require_dependency 'help/application_controller' module Help class TicketSubjectsController < ApplicationController # :nodoc: before_action :set_ticket_type def new @ticket_subject = @ticket_type.ticket_subjects.new end def edit; end def update @subject.update_attributes!(set_param...
class HelpController < ApplicationController def index if params.has_key?('key') @dataset = Dataset.find_by_key(params['key']) end # Rails.logger.warn @dataset.to_yaml end def sensitive end def help_mail if params.has_key?("nobots") # ignore the spam else help_request =...
require './lib/fizz_buzz/noizer' module FizzBuzz class Fizzer < Noizer def initialize number=1, rule=nil, message="Fizz" rule ||= lambda{|n| n % 5 == 0} super number,rule, message end end end
# 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...
require 'google/api_client' # This runs a Google image search and posts a relevant image link when a user # in the channel provides a file name matching the regex below. # # General format: [query].[file_type] # # @author wyattisimo # class AutoImage include Cinch::Plugin match /(^|\s)([\w\-'!]+)\.(gif|jpg|...
# frozen_string_literal: true require "spec_helper" describe GraphQL::Schema::Field::ConnectionExtension do class ConnectionShortcutSchema < GraphQL::Schema class ShortcutResolveExtension < GraphQL::Schema::FieldExtension def resolve(arguments:, **rest) collection = ["a", "b", "c", "d", "e"] ...
require 'uns_core/complication_base' module UnsFeeder class Complication < UnsCore::ComplicationBase def initialize end def user_bindings { :rivers => {:many => true, :class_name => 'UnsFeeder::River'} } end def searchable [ UnsFeeder::Story, ] ...
class AddXGridToGraphic < ActiveRecord::Migration[5.2] def change add_column :graphics, :x_grid, :integer add_column :graphics, :y_in_lines, :integer add_column :graphics, :height_in_lines, :integer add_column :graphics, :draw_frame, :boolean, default: false add_column :graphics, :detail_mode, :bo...
class MigratUsers < ActiveRecord::Migration def self.up old_users = OldUser.all old_users.each do |old_user| devise_old_user = User.find(old_user.id) devise_old_user.update_attributes(:password => old_user.password, :password_confirmation => old_user.password) devise_old_user.skip_confirmation! devise_old_u...
class EmployeeController < ApplicationController def new end def create form_params = employee_params @employee = Employee.new(form_params) if @employee.save redirect_to employee_index_path flash[:success] = format( 'Successfully added employee %s %s with id %d.', form_pa...
class MobilePagesController < ApplicationController layout 'mobile' def new @job = current_user.jobs.build end def create @job = current_user.jobs.build(job_params) if @job.save flash[:success] = "Job created!" redirect_to finish_job else redirect_to finish_job end end end
class FrontEndLoginPage # Not doing all the elements here just to save some time. def initialize(browser) @browser=browser Watir::Wait.until { @browser.button(:type,"submit").exists? && @browser.button(:type,"submit").visible? } Watir::Wait.until { @browser.input(:name,"password").exists? && @browser.input(:n...
require 'sinatra/head/data_helpers' # Helper methods module Sinatra module Head # Methods intended for view or layout templates, to generate the usual set of metadata and include tags. module TagHelpers # Spits out a default <head> element which incorporates the <meta> and <title> elements as w...
require File.join(File.dirname(__FILE__), '../../lib/sequel_core') require File.join(File.dirname(__FILE__), '../spec_helper.rb') require 'logger' unless defined?(MYSQL_DB) MYSQL_URL = (ENV['SEQUEL_MY_SPEC_DB']||'mysql://root@localhost/sandbox') unless defined? MYSQL_URL MYSQL_DB = Sequel.connect(MYSQL_URL) end un...
# frozen_string_literal: true class Eslint < Aid::Script def self.description 'Runs eslint against our JavaScript' end def self.help <<~HELP Usage: $ aid eslint This will run eslint against our JavaScript codebase. HELP end def run step 'Linting JavaScript...' do system! ...
require "rails_helper" feature "Authenticated user can edit review on site" do scenario "User successfully edits a review for site" do review = FactoryGirl.create(:review) sign_in_as(review.user) visit edit_site_review_path(review.site, review) fill_in "Rating", with: "1" click_on "Update Review...
# # @author Kristian Mandrup # # Marshallers can be used by Storages to handle conversion from # between a role list of symbols and the data format stored in the datastore # One example is the Bitmask marshaller, which converts between an Integer and a role list # One could imagine other custom marshallers, such as u...
require "csv" module Ncr # Make sure all table names use "ncr_XXX" def self.table_name_prefix "ncr_" end EXPENSE_TYPES = %w(BA60 BA61 BA80) BUILDING_NUMBERS = YAML.load_file("#{Rails.root}/config/data/ncr/building_numbers.yml") class WorkOrder < ActiveRecord::Base # must define before include Pur...
class Product < ActiveRecord::Base has_many :line_items has_many :orders, through: :line_items validates :title, :description, :image_url, presence: true validates :price, numericality: {greater_than_or_equal_to: 0.01} validates :title, uniqueness: true validates :image_url, :uniqueness => true validates :pric...
Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # s.name = "TailoredFloatingLabelTextInput" s.version = "1.0.0" s.summary = "An iOS text input field written in Swift, tailored to your needs." s.description = <<-DESC A highly customizable text in...
require "rails_helper" feature "un-completing a Task", js: true do scenario "Identity sets a completed Task to incomplete" do given_i_have_set_a_task_to_complete when_i_set_the_task_to_incomplete then_i_should_see_that_the_task_is_incomplete end def given_i_have_set_a_task_to_complete assignee ...
require 'pry' require_relative 'card' class Deck attr_accessor :player, :cards, :rank, :suit, :value def initialize(player) puts "--- Black Jack ---\n".colorize(:blue); sleep 1 puts "Welcome #{player.name.capitalize}" puts "You have $#{player.bank_roll} dollars to play with!\a" @player = player @ra...
require 'parslet' require 'searchparser/boolean_skeleton' require 'searchparser/balanced' require 'searchtree' module SearchParser class BooleanKeywordParser < Parslet::Parser include BooleanSkeleton # Just need to define the "base" -- our keyword # definition # We'll take double-quoted strings, of...
class RenameSvgLatLngFromWines < ActiveRecord::Migration def change rename_column :wines, :svg_latitude, :latitude rename_column :wines, :svg_longitude, :longitude end end
class Mhp2::DecoratorSerializer < ActiveModel::Serializer attributes :id, :name, :rare, :slot, :skill_systems end
require 'minitest/autorun' require 'minitest/pride' require './lib/placement_validator' require './lib/grid' require './lib/ship' class PlacementValidatorTest < Minitest::Test def test_it_exists g = Grid.new s = Ship.new(2) p = PlacementValidator.new(g, s, "A1", "A2") assert p end def test_it_ca...
# # Cookbook Name:: wesabot # Recipe:: default # # Copyright 2011, Estately, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
require 'rails_helper' RSpec.describe 'user adds address to company' do it 'submits additional address from company show page' do VCR.use_cassette('add_address') do user_logs_in company = create_approved_company visit company_path(company) click_on 'Add Location' fill_in 'location_s...
class CreateSpecifications < ActiveRecord::Migration def change create_table :specifications do |t| t.string :version_name t.float :engine_power t.float :displacement t.float :mileage t.boolean :is_available t.boolean :air_bag t.boolean :abs t.string :color t....
# Shows you how to minimally implement the ActiveModel::Validator # API into a custom model class ValidatorPerson include ActiveModel::Validations validates_with HasNameValidator # Can be found in /lib attr_accessor :name end
class CheckSerializer < ActiveModel::Serializer attributes :question, :score, :type, :checksum, :correct_answers, :user_answers has_many :answers, serializer: CheckAnswerSerializer def question object.question_body end def type object.question_type end def correct_answers object.correct_a...
class Post < ApplicationRecord #title(必須,3文字以上) validates:title,presence:true,length:{ minimum:3,message:'タイトルが短すぎます' } #context(必須) validates:context,presence:true end
class CreateArticles < ActiveRecord::Migration def self.up create_table :articles do |t| t.string :title, :null => false t.integer :good_count, :default => 0 t.integer :view_count, :default => 0 t.string :state, :limit => 20, :default => "未发布" t.string :author, :limit => 100 ...
class ApiController < ApplicationController def rates keys = [:from, :to] keys.each { |k| params[k].upcase! } render json: Rate.where(params.slice(*keys).symbolize_keys).all end end
class PaymentsController < ApplicationController def create @product = Product.find(params[:product_id]) @user = current_user token = params[:stripeToken] #create the charge on stripe's servers - charge the user's card begin charge = Stripe::Charge.create( :amount => @product.price_in_cents, :cu...
require 'simplecov' SimpleCov.start require 'minitest/autorun' require 'minitest/reporters' require 'minitest/skip_dsl' require_relative '../lib/tilebag' describe "TileBag class" do describe "initialize" do it "Initializes instance of all default tiles" do tiles = Scrabble::TileBag.new tiles.tiles.w...
class AddNamesToNotifications < ActiveRecord::Migration def change add_column :notifications, :assoc_name, :string add_column :notifications, :event_name, :string add_column :notifications, :sender_name, :string add_column :notifications, :receiver_name, :string end end
class RenameTypeToMethod < ActiveRecord::Migration def change rename_column :backups, :type, :method end end
class Admin::ReportsController < ApplicationController def xls XlsReport.serialize send_file("#{Rails.root}/tmp/webstripe.xlsx", :type =>'application/vnd.ms-excel', :disposition => "attachment") end end
class GithubParser < BaseParser GITHUB_SIGNATURE_KEY = 'HTTP_X_HUB_SIGNATURE_256'.freeze def self.can_parse?(raw_hook) raw_hook.headers.key?(GITHUB_SIGNATURE_KEY) end private def verified? Rack::Utils.secure_compare(expected_signature, actual_signature) end def expected_signature payload_b...