text stringlengths 10 2.61M |
|---|
class CreateProducts < ActiveRecord::Migration[5.2]
def change
create_table :products do |t|
t.string :name, null: false
t.text :description
t.float :price_origin, default: 0.0, index: true
t.decimal :price_with_discount, precision: 5, scale: 2, comment: "total digit 5 and scale upto 2 onl... |
namespace :user do
desc 'create a new user'
task :create, [:quantity] => :environment do |task, args|
begin
args[:quantity].to_i.times do
User::CreateInteractor.new.execute!
end
rescue ActiveRecord::RecordInvalid => error
puts "Exception rescue: #{error.message}"
end
end
d... |
class CreateCommunities < ActiveRecord::Migration[5.2]
def change
create_table :communities do |t|
t.string :name, index: true, null: false
t.string :country, index: true, default: "中国"
t.string :province, index: true
t.string :city, index: true
t.string :district
t.string :roa... |
require 'test_helper'
class ProgramCyclesControllerTest < ActionDispatch::IntegrationTest
setup do
@program_cycle = program_cycles(:one)
end
test "should get index" do
get program_cycles_url
assert_response :success
end
test "should get new" do
get new_program_cycle_url
assert_response ... |
module RadiantCacheBusterExtension
VERSION = '0.0.1'
SUMMARY = %q{Cache Buster tag for Radiant CMS}
DESCRIPTION = SUMMARY
URL = "http://github.com/jmervine/radiant-cache_buster-extension"
AUTHORS = ["Josh Mervine"]
EMAIL = ["joshua@mervine.net"]
end
|
class Product < ActiveRecord::Base
#validates name, price required, and maybe category [if category name is required]
belongs_to :category
belongs_to :brand
has_many :line_items
before_destroy :ensure_not_referenced_by_any_line_items
#by using brand and category instead of brand_id, category_id, we are maki... |
require 'crake/util'
require 'crake/project'
# CRake's module. You may include it in classes or in main
module CRake
# Version info
module Version
MAJOR = 0
MINOR = 1
PATCH = 0
STRING = [MAJOR, MINOR, PATCH].join('.')
end
######################################
# Module constants
# De... |
class DhokebaazSupport < ActiveRecord::Base
belongs_to :dhokebaaz
belongs_to :user
validates_uniqueness_of :ip_address, scope: :dhokebaaz_id
end
|
WEAPONS = {
"Unarmed" => {cost: 0, attack: 0, defense: 0},
"Dagger" => {cost: 8, attack: 4, defense: 0},
"Shortsword" => {cost: 10, attack: 5, defense: 0},
"Warhammer" => {cost: 25, attack: 6, defense: 0},
"Longsword" => {cost: 40, attack: 7, defense: 0},
"Greataxe" => {cost: 74, attack: 8, defense: 0}
}.va... |
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "hastats/version"
Gem::Specification.new do |s|
s.name = "hastats"
s.version = HAStats::VERSION
s.authors = ["Travis Petticrew"]
s.email = ["bobo@petticrew.net"]
s.homepage = ""
s.summary = %q{A tool ... |
class MenuDecorator < Draper::Decorator
delegate_all
decorates_association :published_children
decorates_association :parent
decorates_association :binder
def link(**options, &block)
binder.link(to_s, options, &block) if binder
end
def to_s
title
end
end
|
class ContributionsController < ApplicationController
# before_action :set_contribution, except: [:new, :index, :create]
before_action :set_item, except: [:show]
def create
@contribution = Contribution.new(contribution_params)
@contribution.state = "pending"
@contribution.amount_cents = @contribution... |
module Admin
class ApplicationController < Administrate::ApplicationController
include AuthenticationConcern
include AuthorizationConcern
before_action :require_authentication, :require_admin
end
end
|
# coding: utf-8
require_relative 'helper'
require 'yaml'
class TestWriterGroups < Test::Unit::TestCase
setup do
@writer = MultiExiftool::Writer.new
@writer.filenames = %w(a.jpg b.bmp c.tif)
end
test 'simple case' do
@writer.values = {:exif => {:comment => 'test'} }
command = ['exiftool', '-exi... |
##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
class Metasploit3 < Msf::A... |
# encoding: UTF-8
require_relative '../test_helper'
describe "creq chk" do
let(:cmd) { 'chk' }
it 'must check repo for wrong links' do
inside_sandbox do
inside_src do
File.write('req.1.md', "# [req.1] req 1\n\n Wrong [[req.x]] link\n")
File.write('req.2.md', "# [req.2] req 2\n\... |
require 'rails_helper'
RSpec.describe Game, type: :model do
let(:game) { Game.new(word: "fish", guesses: "", game_status: 1, wrong_guesses: 0, user: user) }
let(:user) {User.new(name: "Bob", email: "bob@bob.com", password_digest: "puppies")}
describe "#word_display" do
context "when a new word is chosen fo... |
FactoryBot.define do
factory :product, class: Inventory::Product do
name { Faker::Lorem.word }
description { Faker::Lorem.word }
manufacturer { Faker::Lorem.word }
catalogue { build(:catalogue) }
facility { build(:facility) }
facility_strain { build(:facility_strain) }
end
end |
require 'test_helper'
class MusicalInstrumentsControllerTest < ActionDispatch::IntegrationTest
setup do
@musical_instrument = musical_instruments(:one)
end
test "should get index" do
get musical_instruments_url
assert_response :success
end
test "should get new" do
get new_musical_instrument... |
# 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... |
module Belafonte
module Errors
# Raised when an app attempts to mount itself
CircularMount = Class.new(StandardError)
# Raised when creation of an argument breaks the arg rules
InvalidArgument = Class.new(StandardError)
# Raised when a name is required but not provided
NoName = Clas... |
module Piano
module LiquidTags
class TitleChain < ::Liquid::Tag
include ShopsHelper
Syntax = /(#{::Liquid::QuotedFragment})\s+(#{::Liquid::QuotedFragment})/
def initialize(tag_name, markup, tokens)
if markup =~ Syntax
@shop = $1
@shop_category = $2
else
... |
require 'spec_helper'
describe Address do
context 'address with duplicate latitude and longitude' do
it 'is invalid' do
expect { FactoryGirl.create(:address, latitude: 1.0, longitude: 2.0) }.to raise_error(ActiveRecord::RecordInvalid)
end
end
end |
class Location < ActiveRecord::Base
attr_accessible :title, :description
validates_presence_of :title
has_many :workplace_assignments
has_many :groups, through: :workplace_assignments, class_name: "MDB::Group"
# has_many :shifts, as: :context
def users
groups.users
end
def to_s
title
... |
control "V-73051" do
title "PostgreSQL must automatically terminate a user session after
organization-defined conditions or trigger events requiring session disconnect."
desc "This addresses the termination of user-initiated logical sessions in
contrast to the termination of network connections that are associ... |
class CreateExperiences < ActiveRecord::Migration[5.2]
def change
create_table :experiences do |t|
t.string :companyName
t.string :jobCategory
t.date :hiringDate
t.date :leavingDate
t.string :contractType
t.boolean :isDisabledContract
t.text :businessOutline
t.datet... |
#!/usr/bin/ruby
# frozen_string_literal: true
# PanConstants constants for panthage
class PanConstants
@DEBUGGING = false
@QUIET = '--quiet'
def initialize; end
def self.disable_verbose
PanConstants.debugging ? '' : @QUIET
end
def self.debugging
@DEBUGGING
end
def self.debugging=(new_value)... |
class AddLineIdToHousehold < ActiveRecord::Migration[6.1]
def change
add_column :households, :line_id, :string
end
end
|
require 'spec_helper'
require 'rails_helper'
describe FeedbackController do
describe 'show feedback' do
before :each do
@feedback_result = [['feedback_text', 'test user', '2018-11-11', 5]]
@feedback = Feedback.new(:feedback_text => 'feedback_text', :user_id => 1, :created_at => '2018-11-11', :rating ... |
require_relative "animal"
class Beaver < Animal
def self.type_value
"Бобер"
end
def pet
phrases = [super, "Ваш бобрик бъёт хвостом об пол от удовольствия!", "Кажется, он спал, но все равно рад вашему вниманию!"]
vars = [1,1,1,0,2]
phrases[vars[rand(vars.length)]]
end
end |
module TroleGroups
class Config
module ValidRoleGroups
def add_valid_rolegroups *rolegroups
valid_rolegroups =valid_rolegroups & rolegroups
end
def valid_rolegroups= *rolegroups
vrs = rolegroups.flatten.map{|r| r.to_s.alpha_numeric}.map(&:to_sym).uniq
raise ArgumentE... |
module ApplicationHelper
def get_stylesheets
@direction = (rtl?) ? 'rtl/' : ''
stylesheets = [] unless stylesheets
["#{@direction}#{controller.controller_path}/#{controller.action_name}"].each do |ss|
stylesheets << ss
end
plugin_css_overrides = FedenaPlugin::CSS_OVERRIDES["#{controller.cont... |
class Api::V1::BackScratchersController < Api::V1::ApiController
before_action :set_item, only: [:show, :update, :destroy]
def index
@items = Item.all
render json: @items, status: :ok
end
def show
render json: @item, status: :ok
end
def create
@item = Item.new(item_params)
if @item... |
require 'bundler'
Bundler.require :default
# Datamapper
DataMapper::Logger.new $stdout, :debug
DataMapper.setup :default, 'postgres://localhost/nid_development'
DataMapper::Pagination.defaults[:size] = 5
DataMapper::Pagination.defaults[:per_page] = 20
DataMapper::Pagination.defaults[:pager_class] = "pager group"
clas... |
require 'rake/clean'
require 'redcarpet'
CLOBBER.include('site')
def markdown_convert(source_file, dest_file)
markdown = Redcarpet::Markdown.new(
Redcarpet::Render::XHTML)
html = markdown.render(open(source_file).read)
open(dest_file,'w').print(html)
end
desc "Generate index.html"
task :index do
mkdir_p ... |
# 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... |
class Admin::ImagesController < Admin::BaseController
before_action :set_image, only: %i[destroy]
def new
@image = Image.new
end
def create
@image = Image.new(image_params)
if @image.save
flash[:success] = "#{@image.title} has been Created!"
redirect_to image_path(@image)
else
... |
#!/usr/bin/env ruby
begin
require 'rubygems'
require 'AWS'
require 'optparse'
require 'date'
require 'common'
rescue LoadError
puts "Could not load a required module. Make sure you have the gem 'amazon-ec2' installed."
exit(1)
end
ACCESS_KEY_ID = ENV['AMAZON_ACCESS_KEY_ID']
SECRET_ACCESS_KEY = ENV['AMAZ... |
# frozen_string_literal: true
module Decidim
module Opinions
module Admin
# A command with all the business logic when an admin imports opinions from
# a participatory text.
class PublishParticipatoryText < UpdateParticipatoryText
# Public: Initializes the command.
#
# f... |
require './bank_account.rb'
describe BankAccount do
it 'created with an opening balance and the name of the client' do
account = BankAccount.new(1000, 'Diane')
expect(account).to be_a(BankAccount)
end
it "can report its balance" do
account = BankAccount.new(1000, 'Diane')
expect(account.balance... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_one_attached :photo
has_many :courses, dependent... |
class Card
attr_accessor :name, :description, :cost, :active_numbers, :count, :value, :color, :symbol, :search_dict
def initialize(name)
base_card = Card.card_list[name]
@name = name
@description = base_card[0]
@cost = base_card[1]
@active_numbers = base_card[2]
@value = base_card[3]
@se... |
module Bookable
module Generators
class JsGenerator < Rails::Generators::Base
source_root File.expand_path('../templates/assets/javascript', __FILE__)
argument :bookable_js_name, :type => :string, :default => "resource"
def generate_bookable_js
template "custom.js", "app/assets/javascri... |
class IpAddressNetworkPortAssignmentsController < ApplicationController
# sets the @auth object and @object
before_filter :get_obj_auth
before_filter :modelperms
# GET /ip_address_network_port_assignments
# GET /ip_address_network_port_assignments.xml
def index
## BUILD MASTER HASH WITH ALL SUB-PARAMS ... |
class CreateProfiles < ActiveRecord::Migration
def change
create_table :profiles do |t|
t.integer :user_id
t.integer :age
t.string :gender
t.string :mStatus
t.string :education
t.integer :credit
t.string :occupation
t.integer :income
t.string :zip
t.stri... |
json.array!(@snaps) do |snap|
json.extract! snap, :id, :user_id, :photo, :content, :reception_time
json.url snap_url(snap, format: :json)
end
|
# code here!
class School
attr_reader :name, :roster
def initialize(name)
@name = name
@roster = {}
end
def add_student(student_name, student_grade)
if (!@roster[student_grade])
@roster[student_grade] = []
end
@roster[student_grade] << student_name
end
def grade(grade_num)
@... |
# frozen_string_literal: true
module Api::V1::Videos
class IndexAction < ::Api::V1::BaseAction
include ::TransactionContext[:videos_scope]
step :validate, with: 'params.validate'
map :build_finder_params, with: 'params.finder.build'
tee :find_videos
map :build_meta, with: 'meta.paginate'
map... |
##
# This model tracks strain that is grown in one facility and also
# keeps record of data/ settings specific to this relationship eg.
# - THC & CBD over 2 years
# - Test arrangement
#
module Inventory
class FacilityStrain
include Mongoid::Document
include Mongoid::Timestamps::Short
field :thc, type: Fl... |
class ApplicationMailer < ActionMailer::Base
default from: ENV['MAILER_FROM_ADDRESS']
def self.configured?
hostname = ENV['MAILER_SMTP_ADDRESS']
return(hostname.present? && hostname != 'test')
end
def ticket_email(ticket, sent_at = Time.now)
unless self.class.configured?
raise ArgumentError,... |
class MP3Importer
attr_accessor :path, :filenames
def initialize(path)
@path = path
@filenames = []
end
def files
Dir["#{@path}/**/*.mp3"].each do |filename|
@filenames << filename[filename.rindex("/") + 1..-1]
end
@filenames
end
def import
self.files
@filenames.map {|fil... |
class PaymentsController < ApplicationController
before_action :set_checkup
def new
end
def create
customer = Stripe::Customer.create(
source: params[:stripeToken],
email: params[:stripeEmail]
)
charge = Stripe::Charge.create(
customer: customer.id, # You should store thi... |
class AddNameToProduct < ActiveRecord::Migration
def change
add_column :products, :name, :string
add_column :products, :purchase_type, :string
add_column :products, :quantity, :integer
add_column :products, :term, :string
end
end
|
Rails.application.routes.draw do
devise_for :users, path: '/', path_names: {
sign_in: 'login',
sign_out: 'logout',
sign_up: 'registration'
},
controllers: { registrations: 'users/registrations', sessions: 'users/sessions' }
devise_for :adm... |
# == Schema Information
#
# Table name: votes
#
# id :integer not null, primary key
# voter_id :integer not null
# answer_id :integer not null
# value :integer default("0")
#
class Vote < ActiveRecord::Base
validates :voter, :answer, presence: true
validates :val... |
class CreateLogs < ActiveRecord::Migration[5.2]
def change
create_table :logs do |t|
t.string :processed_by, null: false
t.string :past_user
t.string :past_record, array: true, default: [], null: false
t.timestamps
end
end
end
|
require "spec_helper"
describe Feed do
let(:user) { create :user }
let(:nick) { create :user }
let(:peter) { create :user }
let(:subject) { Feed.new(user) }
let!(:activity_1) { create :following_activity, :user => user, :created_at => DateTime.new(2013, 2, 2) }
let!(:activity_2) { create :following_activit... |
require 'byebug/setting'
module Byebug
#
# Setting for automatic evaluation of unknown commands.
#
class AutoevalSetting < Setting
DEFAULT = true
def banner
'Automatically evaluate unrecognized commands'
end
end
end
|
# encoding: utf-8
require 'spec_helper'
describe Project do
fixtures :projects, :builds, :dependencies, :buckets, :logs
before(:each) do
@project = Project.find(1)
end
it "should have an id" do
expect(@project.id).to eq(1)
end
it "should have a name" do
expect(@project.name).to eq("project n... |
require "helper"
require File.join 'adapters', 'finda.co.nz'
describe "Searching finda.co.nz" do
it "only returns names entries that contain the search term in the name" do
expected = "kudos"
result = Finda.new.search :term => expected
expect(result.all?{|it| it.name.downcase.include?(expected.downcase... |
class AddForeignKeys < ActiveRecord::Migration
def self.up
add_column :companies, :person_id, :integer, :null => false, :default => 0,
:options => 'CONSTRAINT fk_company_person REFERENCES people(id)'
add_column :projects, :company_id, :integer, :null => false, :default => 0,
:opt... |
class CreateDatMilestones < ActiveRecord::Migration
def self.up
create_table :dat_milestones do |t|
t.integer "project_tree_id", :null => false
t.date "mils_date"
t.integer "create_user_id", :null => false
t.datetime "created_on", :null => false
t.integer "updat... |
class RemoveEndLocationFromHikes < ActiveRecord::Migration[6.0]
def change
remove_column :hikes, :end_location, :float
end
end
|
class SellsController < ApplicationController
before_action :authenticate_user!
before_action :set_sellitem, only:[:show,:edit,:destroy,:update]
def index
end
def delete
end
def new
@sellitem = Sellitem.new
@sellitem.images.build
@parents = Category.roots
end
def create
@s... |
Rails.application.routes.draw do
devise_for :users
root 'root#index'
resources :projects do
resources :boards
end
end
|
require 'test_helper'
class AnnoucementsControllerTest < ActionController::TestCase
setup do
@annoucement = annoucements(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:annoucements)
end
test "should get new" do
get :new
assert_respon... |
# Rewrite your recursive fibonacci method so that it computes its results without recursion.
# (n - 1) + (n - 2)
require 'pry'
def fib_written(num)
arr = []
number = 1
first = (number - 1)
second = (number - 2)
1.upto(num) do
if number <= 2
arr << number
number += 1
else
arr << fi... |
# abstract
class Beverage
@description = "Unknown bewerage"
def get_description
@description
end
def cost
# abstract
raise "# abstract: (cost) Should be defined in subclasses!"
end
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
class Partay
include HTTParty
base_uri 'https://calm-sea-8595.herokuapp.com'
end
end
|
module OneDoc
class DataStructure
def initialize(type, doc)
@type = type
@doc = doc
end
def add_member(member)
@members << member
end
end
end |
File.open(ARGV[0]).each_line do |line|
line.split(' ').collect { |i| i.to_f }.sort.each do |item|
print "%.3f " % item
end
puts
end |
name 'git'
maintainer 'Opscode, Inc.'
maintainer_email 'cookbooks@opscode.com'
license 'Apache 2.0'
description 'Installs git and/or sets up a Git server daemon'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '4.2.2'
recipe 'gi... |
require 'test_helper'
module Commands
class HelpCommandTest < Test::Unit::TestCase
def test_execute
command = HelpCommand.new
command.expects(:post_as_bot).with(GroupMe::KRYPPIE_BOT_ID, help_message)
assert_nothing_raised do
command.execute
end
end
private
def help_me... |
FactoryBot.define do
factory :feedback_message do
message { "Feedback message that has been left." }
path { "https://example.com/diaperbank/dashboard" }
user { User.try(:first) || create(:user) }
resolved { false }
end
end
#
# id :bigint(8) not null, primary key
# user_id :bigint... |
require_relative 'testing_object'
require_relative '../lib/nested_send'
describe Object do
before(:each) do
@object = TestingObject.new
end
describe "object attribute access" do
it "will allow access to object attributes" do
expect(@object.nested_send("name")).to eq("Will")
end
it "wi... |
class AddColumnPowerOrders < ActiveRecord::Migration[4.2]
def change
add_column :power_orders, :item_url, :string
end
end
|
class Event < ActiveRecord::Base
include PublicActivity::Model
tracked only: [:update, :create], :owner => :band
belongs_to :band
has_attached_file :flyer, styles: { medium: "300x300>", thumb: "100x100>" }, default_url: "/images/:style/missing.png"
validates_attachment_content_type :flyer, content_type: /\Aima... |
class AddMoreInfoToOffers < ActiveRecord::Migration[5.1]
def change
add_column :offers, :date, :datetime
end
end
|
require 'minitest/autorun'
require 'minitest/pride'
require './lib/binary_search_tree'
require './lib/node'
class BinarySearchTreeTest < Minitest::Test
def setup
@tree = BinarySearchTree.new
end
def test_it_exists
assert_instance_of BinarySearchTree, @tree
end
def test_insert_creates_node
@tree... |
require "rails_helper"
RSpec.describe Api::V1::Merchants::ItemsController, type: :controller do
describe "GET #index.json" do
let(:json_response) { JSON.parse(response.body) }
let(:merchant) { create(:merchant) }
let(:items) { create_list(:item, 2)}
it "responds with successful 200 HTTP status code"... |
class Stream < ActiveRecord::Base
has_many :main_subjects
has_one :stream_cutoff
has_one :stream_quota
validates :stream_name, presence: true, length: { in: 2..20 }
end
|
require("minitest/autorun")
require('minitest/reporters')
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
require_relative('../models/guest.rb')
require_relative('../models/karaoke_room.rb')
require_relative('../models/bar.rb')
require_relative('../models/song.rb')
class GuestTest < MiniTest::Test
d... |
# -*- encoding: utf-8 -*-
require 'rake'
require 'rspec/core/rake_task'
desc 'Test Zenity'
task :default => :spec
desc 'Test Zenity with rspec'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = ['--color']
end
desc 'Check for code smells'
task :reek do
puts 'Checking for code smells...'
files = Dir.glob ... |
class Euler031
require 'pry'
def initialize()
@coins = %w(1 2 5 10 20 50 100 200)
@total = 200
@ways = {}
@ways[0] = 1
end
def solve
@coins.each do |coin|
coin = coin.to_i
(coin..@total).each do |i|
if @ways[i]
@ways[i] += @ways[i-coin]
else
... |
# original dataset: http://www.census.gov/library/infographics/veterans-statistics.html (Table 1)
# data from 2009 - 2013
require 'json'
require 'csv'
def separate_comma(number)
number.to_s.chars.to_a.reverse.each_slice(3).map(&:join).join(",").reverse
end
csv_data = File.read('veterans_data.csv')
csv = CSV.parse(c... |
# encoding: utf-8
module TuneMyGc
VERSION = "1.0.71"
end
|
class UserStocksController < ApplicationController
before_action :set_user_stock, only: [:show, :edit, :update, :destroy]
# GET /user_stocks
# GET /user_stocks.json
def index
@user_stocks = UserStock.all
end
# GET /user_stocks/new
def new
@user_stock = UserStock.new
end
# POST /user_stocks
... |
describe 'Application Controller' do
describe 'root path' do
it 'renders the user input-a-mood form' do
get '/'
expect(last_response.body).to include('<form action="/moods" method="POST">')
end
end
end |
json.payment do
json.region_id @person.domestic_region_id
json.id @person.id
json.name @person.name
json.street @person.domestic_address_street
json.city @person.domestic_address_city
json.zip @person.domestic_address_zip
json.email @person.email
json.membership_type @person.membership_type
json.date_... |
class GroceryItemsController < ApplicationController
def unpurchased
render json: GroceryItem.unpurchased
end
end
|
class CreateArtists < ActiveRecord::Migration[6.1]
def change
create_table :artists do |t|
t.string :at_name
t.string :genre
t.string :type
t.string :other
t.text :more
t.string :recommend
t.timestamps
end
end
end
|
class Category < ApplicationRecord
has_many:memos
end
|
# encoding: utf-8
require 'new_relic/agent'
DependencyDetection.defer do
named :cassandra
depends_on do
defined?(::Cassandra::Session)
end
executes do
::NewRelic::Agent.logger.info 'Installing Cassandra ruby-driver instrumentation'
end
executes do
require 'new_relic/agent/datastores'
[:... |
class AddKeyVariablesToOrganizations < ActiveRecord::Migration
def change
add_column :organizations, :external_bucket_env_var_access, :string
add_column :organizations, :external_bucket_env_var_secret, :string
end
end
|
module Omniship #:nodoc:
class TrackingResponse < Response
attr_reader :tracking_number # string
attr_reader :shipment_events # array of ShipmentEvents in chronological order
attr_reader :origin, :destination
def initialize(success, message, params = {}, options = {})
@tracking_number = o... |
class PatientsAndAllergies < ActiveRecord::Migration[5.2]
def change
create_table :patients do |t|
t.date :fecha_ultima_consulta
t.string :tipo_sangre
end
create_table :allergies do |t|
t.references :patient
t.string :nombre
t.date :fecha_alta
t.string :medicamento
... |
class CreateSentEmails < ActiveRecord::Migration
def change
create_table :sent_emails do |t|
t.string :slug, :limit => 10
t.string :to
t.string :name
t.integer :user_id
t.integer :prospect_id
t.integer :campaign_id
t.boolean :solicited
t.timestamps
end
add_i... |
class Wines::Style < ActiveRecord::Base
include Wines::WineSupport
has_many :registers
has_many :details
has_many :children, :class_name => :Style, :foreign_key => :parent_id
belongs_to :parent, :class_name => :Style, :foreign_key => :parent_id
def name
"#{name_en}/#{name_zh}"
end
end
|
require "minitest/autorun"
require "./lib/aemninja/helpers.rb"
require 'fileutils'
class HelpersTest < Minitest::Test
def test_create_directory
assert_output(/create/) do
Aemninja::Helpers::create_directory("test-directory")
end
assert File.directory? "test-directory"
# Clean Up
FileUtils... |
Pod::Spec.new do |spec|
spec.platform = :ios
spec.ios.deployment_target = '12.0'
spec.name = "RWPickFlavor"
spec.summary = "RWPickFlavor lets a user select an ice cream flavor."
spec.requires_arc = true
spec.version = "0.1.0"
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.author = { "Maksym Ivanyk" => "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.