text stringlengths 10 2.61M |
|---|
RSpec.describe "`github_rb config` command", type: :cli do
it "executes `github_rb help config` command successfully" do
output = `github_rb help config`
expected_output = <<-OUT
Usage:
github_rb config GITHUB_API_KEY
Options:
-h, [--help], [--no-help] # Display usage information
Add GitHub api key to ... |
class GroupController < ApplicationController
before_action -> { @model = Model.find(params[:model_id]) }
before_action :set_breadcrumb, only: [:index]
def index
@parts_groups = PartsGroup.all.each_slice(6)
end
def show
@inner_groups = InnerGroup.where(model_id: params[:model_id]).where(parts_grou... |
input = File.readlines("/Users/hhh/JungleGym/advent_of_code/2020/inputs/day11.in").map { |x| x.strip }
def populate(input)
state = Array.new(input.size) { Array.new(input.first.size) }
input.each_with_index do |row, i|
row.chars.each_with_index do |s, j|
adjacent = [
[i-1, j-1], [i, j-1], [i+1,... |
class BlurbsController < ApplicationController
def index
@blurbs = Blurb.all
end
def new
@blurb = Blurb.new
end
def create
Blurb.create(blurbs_params)
redirect_to root_path
end
private
def blurbs_params
params.require(:blurb).permit(:title, :details)
end
end
|
class AddVisibleToPuppies < ActiveRecord::Migration[5.0]
def change
add_column :puppies, :visible, :boolean, default: true
end
end
|
class FacilitiesManagement::Supplier::ContractsController < FacilitiesManagement::Supplier::FrameworkController
include FacilitiesManagement::ControllerLayoutHelper
include FacilitiesManagement::Supplier::ContractsHelper
before_action :set_contract
before_action :authorize_user
before_action :set_procurement... |
require 'spec_helper'
RSpec.describe "Node API" do
include Helpers::DrugHelpers
before :each do
setup_drug_data
end
describe "drug-centered node" do
it "should get a valid object" do
get "/api/v1/node/drug/#{@prozac.product_ndc}"
expect(json["name"]).to eq @prozac.proprietary_name
... |
require './lib/wizards/player'
require './lib/wizards/wizard'
require './lib/wizards/room'
describe Player do
let(:rooms) { Rooms.new }
let(:wizard) { Wizard.new(rooms.layout) }
subject do
Player.new(rooms.layout)
end
describe "#initial_position" do
it "the player starts off at postion 0,0" do
... |
class BatchPolicy < ApplicationPolicy
attr_reader :user, :split_file
def initialize(user, batch)
@user = user
@batch = batch
end
def ingest?
user.admin? || user.editor?
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
helper_method :ensure_authenticated!
before_filter :store_return_to
private
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
rescue ActiveRecord::RecordNotFound
... |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
module UploadSpecHelper
def valid_upload_attributes
{
:asset => fixture_file_upload('files/50x50.png', 'image/png'),
:blog_id => 1,
:user_id => 1
}
end
end
describe Upload do
fixtures :users
include UploadSpecHe... |
class Comment < ActiveRecord::Base
attr_accessible :article_id, :body, :name, :published_at
validates :name, presence: true
validates :body, presence: true
belongs_to :article
end
|
class AddConfIdDelegates < ActiveRecord::Migration
def change
add_column :delegates, :conference_id, :integer
add_index :delegates, :conference_id
end
end
|
require './support/env'
class TestPage
include PageObject
include SeleniumUtil
button(:populate_btn,id: 'populate')
button(:submit,id: "submit-button")
text_field(:dev_name,id: 'developer-name')
radio_buttons(:os_rdo,xpath: "//input[@type='radio']")
checkboxes(:features,xpath: ... |
# frozen_string_literal: true
require 'bolt_command_helper'
require 'json'
test_name "C100553: \
bolt plan run should execute puppet plan on remote hosts via ssh" do
extend Acceptance::BoltCommandHelper
ssh_nodes = select_hosts(roles: ['ssh'])
skip_test('no applicable nodes to test on') if ssh_nodes... |
require 'spec_helper'
describe "referrals/new.html.erb" do
before(:each) do
assign(:referral, stub_model(Referral,
:referred => "MyString",
:centre_name => "MyString",
:consultant_name => "MyString"
).as_new_record)
end
it "renders new referral form" do
render
# Run the genera... |
require "watir-webdriver"
class TdNavigator
def initialize
@browser = $config.browser
@proxy_host = $config.proxy['proxy_host']
@no_proxies_on = $config.proxy['proxy_no_proxies_on']
@proxy_port = $config.proxy['proxy_port']
@proxy_enable = $confi... |
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
#before_filter :require_login
def map
# front page
@map_settings = MapSetting.first
end
# View o... |
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by the Rails when you ran the scaffold generator.
describe UsersController do
#_user(stubs={})
#user ||= mock_model(User, s... |
class Admins::ModelingsController < ApplicationController
before_filter :authenticate_admin!
layout "admins"
def index
@modelings = Modeling.all
respond_to do |format|
format.html
end
end
def new
@modeling = Modeling.new
@modeling.photos.build
respond_to do |format|
f... |
class ChangecolumnCartitems < ActiveRecord::Migration
def change
rename_column :cart_items, :cart_id, :user_id
end
end
|
# U2.W4: Calculate a letter grade!
# Complete each step below according to the challenge directions and
# include it in this file. Also make sure everything that isn't code
# is commented in the file.
# I worked on this challenge [by myself, with: ].
# 1. Pseudocode
# What is the input?
#The input will be a set ... |
#! /usr/bin/env ruby
=begin
Tag to create a documentation index.
=end
require 'pathname'
require_relative 'mixins.rb'
module Jekyll
class TocItem < Struct.new(:level, :number, :name, :link, :has_sublevels)
include Liquify
end
class UncatPage < Struct.new(:name, :link)
include Liquify
end
class I... |
class Commodity < ApplicationRecord
with_options presence: true do
validates :name
validates :description
validates :category_id
validates :state_id
validates :postage_id
validates :estimate_id
validates :area_id
validates :image... |
class Admin::PosicionActorsController < ApplicationController
layout 'admin'
require_role "administrador"
# GET /posicion_actors
# GET /posicion_actors.xml
def index
if params[:actor_id]
@actor = Actor.find(params[:actor_id])
@posicion_actors = @actor.posicion_actors.paginate(:per_page => 20, ... |
module Capistrano
class Configuration
class Question
def initialize(env, key, default)
@env, @key, @default = env, key, default
end
def call
ask_question
save_response
end
private
attr_reader :env, :key, :default
def ask_question
$stdou... |
# frozen_string_literal: true
require 'puppler/version'
require 'puppler/utils'
require 'puppler/utils/git'
require 'puppler/git/repository'
require 'puppler/git/bundle'
require 'puppler/git/changes'
require 'puppler/git/refs'
require 'puppler/puppet_module'
require 'puppler/command'
require 'pathname'
# Puppler appl... |
require_relative 'spec_helper'
require_relative "../lib/hiptest-publisher/formatters/reporter"
require_relative '../lib/hiptest-publisher/utils'
describe 'Hiptest publisher utils' do
describe 'show_status_message' do
it 'sends a message on STDOUT with brackets before' do
allow(STDOUT).to receive(:print)
... |
class Survey < ApplicationRecord
belongs_to :client
belongs_to :user
has_many :survey_response_links, dependent: :nullify
has_many :survey_responses, through: :survey_response_links
def questions
survey_responses.map(&:survey_question).uniq
end
end
|
module Shibboleth::Rails
module ControllerAdditions
private
def authenticated?
request.env['employeeNumber'].present?
end
def shibboleth
{:emplid => request.env['employeeNumber'],
:name_n => request.env['REMOTE_USER'].chomp("@osu.edu")}
end
def current_user
return @current_user if defined?... |
class CreateContracts < ActiveRecord::Migration
def change
create_table :contracts do |t|
t.string :breed
t.string :cultivated_area
t.string :transplant_number
t.string :purchase
t.integer :party_a_id
t.integer :party_b_id
t.integer :user_id
t.timestamps null: fals... |
require 'json'
module LegalServices
class DataUploadWorker
include Sidekiq::Worker
sidekiq_options queue: 'default'
def perform(upload_id)
upload = LegalServices::Admin::Upload.find(upload_id)
suppliers = JSON.parse(upload.suppliers_data.file.read)
LegalServices::Upload.upload!(suppli... |
class AfterRegistersController < ApplicationController
BUSSINES_TYPES = %w(consumer retail distributor)
include Mobylette::RespondToMobileRequests
# include PublicActivity::StoreController
before_action :authenticate_user!
before_action :set_type, only: [:show, :update, :status]
# before_action :expires_n... |
require 'spec_helper'
describe Task do
let(:user) { create(:user) }
subject(:task) { build(:task, user_id: user.id) }
it { should be_valid }
describe "#duration" do
it "returns the duration of the task" do
set_times(342, 8372)
expect(subject.duration).to eq 8030
end
end
describe "#mi... |
class AddRolesToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :roles, :integer, array: true, default: [2]
end
end
|
json.array!(@scene_templates) do |scene_template|
json.extract! scene_template, :id, :review_template_id, :name, :description, :sort_order, :max_length, :required, :image_url
json.url scene_template_url(scene_template, format: :json)
end
|
module Screw
module Driver
module Rails
def rails?
@rails
end
def rails_urls
@rails_urls ||= Dir[File.join(public_path, "**", "*.js")]
end
def generate_rails_urls
rails_urls.each do |url|
generate "/javascripts/#{File.basename(url)}", 'text/javascr... |
class Mercado
#as palavras produto e preco aqui são apenas parâmetros podendo serem substituidas por quaisquer outras palavras.
def initialize(produto, preco)
@produto = produto #apenas parâmetros
@preco = preco#apenas parâmetros
end
def comprar
puts "Você comprou o produto #{@produto} no valor de #{@preco}"
... |
#!/usr/bin/ruby
#
# consolidate/aggregate raw post hits files
# input files are assumed to be sorted by doc,term
#
# parameters
# arg 0: input file pattern ( a string in *** quotes *** otherwise linux will expand pattern )
# arg 1: output file
# input format: term,doc,bin1,bin2,bin3...bin10,bin20,..,bin1280,top10,to... |
# frozen_string_literal: true
module Kafka
class ConnectionBuilder
def initialize(client_id:, logger:, instrumenter:, connect_timeout:, socket_timeout:, ssl_context:, sasl_authenticator:)
@client_id = client_id
@logger = TaggedLogger.new(logger)
@instrumenter = instrumenter
@connect_timeo... |
module Plugins
module Attack
module AttackHelper
# here all actions on plugin destroying
# plugin: plugin model
def attack_on_destroy(_plugin)
current_site.attack.destroy_all
end
# here all actions on going to active
# you can run sql commands like this:
# result... |
module Usecase
class SpawnAttachment
def initialize(params:)
@params = params
end
def call
new_attachment.save
new_attachment
end
private
attr_reader :params
def new_attachment
@new_attachment ||= Attachment.new(params)
end
end
end
|
class CreateJoinTableCdsLanguages < ActiveRecord::Migration[5.2]
def change
create_join_table :cds, :languages do |t|
t.index [:cd_id, :language_id]
t.index [:language_id, :cd_id]
end
end
end
|
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Resources
module Properties
class UnicodeDataPropertiesImporter < PropertyImporter
DATA_FILE = 'ucd/UnicodeData.txt'
PROPERTIES = {
2 => 'General_Category',
... |
require "rails_helper"
RSpec.describe Api::V1Controller, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/api/v1/index").to route_to("api/v1#index")
end
it "routes to #book" do
expect(:get => "api/v1/book/1").to route_to("api/v1#book", :id => "1")
end
... |
class Ability
include CanCan::Ability
def initialize(instructor)
if instructor && instructor.admin?
can :access, :rails_admin # grant access to rails_admin
can :manage, :all # allow superadmins to do anything
end
end
end
|
module OrdersHelper
def transaction_fee_label(order)
fee = TransactionFee.calculate(order.total)
("Yes, I'll also pay %s in processing fees so the charity doesn't have to. " % content_tag(:span, fee.format, :id => "transaction-fee-label")).html_safe
end
def transaction_fee(order)
fee = TransactionFe... |
class Api::V1::CompanySearchController < ApplicationController
skip_before_action :authorize!, only: [:show]
def show
company = Company.find_by(name: params[:name])
if company
render json: { company_id: company.id }
else
render json: { error: "company not found" }.to_json, status: 404
... |
require "./FolderWalker"
require "test/unit"
class TC_FolderWalker < Test::Unit::TestCase
# Simple test testing that folder property is correctly set
def test_initialize
assert_equal("./TestFolders/",FolderWalker.new("./TestFolders/").folder)
end
# Test that run finds the correct number of files
def test_r... |
class GameCreator
include ActiveModel::Model
attr_accessor :winner_id, :loser_id, :game
validate :not_same_player
def initialize(winner_id = nil, loser_id = nil)
@winner_id = winner_id
@loser_id = loser_id
end
def save
return false unless valid?
change_in_rating = RatingUpdater.new(winner... |
class ApplicationController < ActionController::Base
before_filter :configure_permitted_parameters, if: :devise_controller?
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
protected
def configure_permitted_paramete... |
class Menu
attr_reader :dishes
def initialize
@dishes = { "Pure Beef Hamburger" => 1,
"Tempting Cheeseburger" => 1.5,
"Triple-Thick Shakes" => 2,
"Golden French Fries" => 0.5,
"Thirst-Quenching Coke" => 0.5,
"Delightful Root Beer" => 0.5,
... |
require 'spec_helper'
describe Modify do
context "modify with block parameter" do
subject { TestModelWithBlockParameter.new }
it_behaves_like "modify"
end
context "modify with lambda parameter" do
subject { TestModelWithLambdaParameter.new }
it_behaves_like "modify"
end
context "modify wit... |
require 'enum_methods'
describe Enumerable do
describe '.my_inject' do
context 'given an empty array, inital value, and block' do
it 'returns nil' do
expect([].my_inject {}).to eql(nil)
end
end
context 'given (1..6), an empty inital value, and block' do
it 'returns nil' do
... |
Bp::Application.routes.draw do
devise_for :users
resources :main
resources :spaces do
resources :requests
resources :models do
resources :nodes
resources :links
resources :agents
resources :gates
end
resources :tool_types do
resources :tools
end
resources ... |
module Lolita
module Version
MAJOR = 4
MINOR = 5
PATCH = 0
BUILD = nil
STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
def self.to_s
STRING
end
def self.major
MAJOR
end
def self.minor
MINOR
end
def self.patch
PATCH
end
def s... |
class GroupsController < ApplicationController
before_action :authenticate_user!
def index
@group = Group.new
@groups = current_user.groups
end
def new
@group = Group.new
@users = User.where(id: current_user.id)
end
def create
@group = Group.new(group_permit_params)
if @group.s... |
module Terminal
class CallCommand < BaseCommand
def run
puts "Command executing: #{name}..."
if options[:objects].empty?
puts 'Error: There is no objects to select!!!'
return
end
puts 'Please select object'
reciever = select_object(options[:objects])
if optio... |
require 'spec_helper'
feature "Tenant Dashboard" do
scenario "viewing after successful login" do
user = login_as_tenant
FactoryBot.create(:reading, user: user, created_at: DateTime.new(2018, 12, 1))
visit user_path(user)
expect(page).to have_content user.name
expect(page).to have_content user.a... |
require 'card'
class Hand
attr_reader :bet, :invalid
attr_accessor :from_split
def initialize( player )
@player = player
reset!
end
# Resets the hand to its original state.
def reset!
@hand = []
@bet = 0
@active = true
@invalid = false
@from_split = false
... |
class CreateLearnerDictionaries < ActiveRecord::Migration
def change
create_table :learner_dictionaries do |t|
t.string :source_language
t.timestamps null: false
end
end
end
|
require_relative "core_ext/object"
require 'set'
require 'benchmark'
class PathFinder
class StepList
# include Comparable
attr_reader :previous, :uid, :depth, :cost, :profit
def initialize(path_finder, previous, uid, profit, cost, depth);
@previous, @uid = previous, uid
@profit, @cost, @dept... |
#
# Cookbook Name:: fuelphp
# Recipe:: default
#
# Copyright 2013, Kenji Suzuki <https://github.com/kenjis>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# ... |
module Roglew
module GL
ALLOW_DRAW_FRG_HINT_PGI ||= 107024
ALLOW_DRAW_MEM_HINT_PGI ||= 107025
ALLOW_DRAW_OBJ_HINT_PGI ||= 107022
ALLOW_DRAW_WIN_HINT_PGI ||= 107023
ALWAYS_FAST_HINT_PGI ||= 107020
ALWAYS_SOFT_HINT_PGI ||= 107021
BACK_NORMALS_H... |
# frozen_string_literal: true
class ReferenceTalksInTalkSummaries < ActiveRecord::Migration[5.1]
def change
add_reference(
:talk_summaries, :talk,
index: true, null: false,
foreign_key: { to_table: :talks }
)
end
end
|
module RBot
module Commands
class Help < Base
command 'help'
match(/^(?<bot>[[:alnum:][:punct:]@<>]*)$/u)
def self.call(client, data, match)
command = match[:expression]
payload = if command.present?
{
text: SlackRubyBot::CommandsHelper... |
module Uber
# When included, allows to add builder on the class level.
#
# class Operation
# include Uber::Builder
#
# builds do |params|
# SignedIn if params[:current_user]
# end
#
# class SignedIn
# end
#
# The class then has to call the builder to compute a class... |
namespace "spec" do
desc "download_stub"
task :download_stub, [:url] do |t, args|
destination = "spec/samples/db/sync_card_data/stubs/#{args[:url].strip.split('/').last}"
File.open(destination, 'wb') do |file|
file.write open(args[:url]).read
end
puts "Downloaded to: '#{destination}'"
end
... |
class ArticlesController < ApplicationController
before_action :set_article, only: [:edit, :show, :update, :destroy]
def index
@articles = Article.all
end
def new
@article = Article.new
end
def edit
end
def create
@article = Article.new(article_params)
@article.user = User.first
if @article.save... |
# frozen_string_literal: true
require 'yaml'
require 'uri'
module Quicken
class Parser
def initialize recipe_path
@recipe_path = recipe_path
@plugins = []
end
def parse
file = load_file(@recipe_path)
recipe = YAML.safe_load(file)
LOGGER.debug(:parser) { "Parsed recipe #{re... |
module SupportTaskEngine
@@current_script = nil
@@scripts = []
def self.config(&block)
module_eval(&block)
end
def self.support_task(name, description, params = {}, instruction = {}, &block)
script = TaskEngineScript.new(name, description, params, instruction)
@@scripts << script
@@cur... |
# frozen_string_literal: true
namespace :mail do
desc 'Re-send receipt email'
task :resend_receipt, [:payment_id] => :environment do |_task, args|
payment = Payment.find(args.payment_id.to_i)
raise '*** Paid in-person' if payment.transaction_id == 'in-person'
transaction = payment.lookup_transaction
... |
class UserStory < ActiveRecord::Base
has_many :topics, :through => :checks
has_many :checks
end
|
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
#
# 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 required by applicabl... |
class ChangeName < ActiveRecord::Migration
def change
rename_column :eocolumns, :type, :coltype
end
end
|
class GalleriesController < ApplicationController
def search
pm = {
page: index_page,
f_search: params[:search],
f_doujinshi: params[:doujinshi] || 1,
f_manga: params[:manga] || 1,
f_artistcg: params[:artistcg] || 1,
f_gamecg: params[:gamecg] || 1,
f_western: params[:west... |
class AddCloserTypeToTickets < ActiveRecord::Migration[5.0]
def up
add_column :tickets, :closer_type, :string
end
def down
remove_column :tickets, :closer_type
end
end
|
json.array!(@reflections) do |reflection|
json.extract! reflection, :id, :user_id, :classroom_id
json.url reflection_url(reflection, format: :json)
end
|
#
# Cookbook Name:: zabbix
# Recipe:: frontend
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
include_recipe "zabbix::default"
package "zabbix-frontend-php" do
action :install
notifies :restart, 'service[apache2]'
end
template "apache.conf" do
path "/etc/zabbix/apache.con... |
module VagrantPlugins
module GuestUbuntu
module Cap
class ChangeHostName
def self.change_host_name(machine, name)
machine.communicate.tap do |comm|
# Get the current hostname
# if existing fqdn setup improperly, this returns just hostname
old = ''
... |
require 'spec_helper'
require_relative '../../../../apps/admin/views/children/index'
describe Admin::Views::Children::Index do
let(:exposures) { Hash[children: []] }
let(:template) { Lotus::View::Template.new('apps/admin/templates/children/index.html.haml') }
let(:view) { Admin::Views::Children::Index.new(... |
class Track < ActiveRecord::Base
belongs_to :program
belongs_to :user, inverse_of: :tracks
has_many :workouts, inverse_of: :track, dependent: :destroy
has_many :measurements, inverse_of: :track, dependent: :destroy
validates :user, :program,
presence: true
def next_step
@next_step ||= if next_ste... |
class Tree
attr_accessor :root
class Node
attr_accessor :data, :parent, :left, :right
def initialize(data)
@data = data
@left = nil
@right = nil
@parent = nil
end
end
class Queue
attr_reader :head, :tail
def initialize
@head = nil
@tail = nil
end... |
class UsersController < ApplicationController
def show
@user = User.find(params[:id])
@failures = @user.failures
end
end
|
class CommentsController < ApplicationController
before_action :authenticate_user!
before_action :set_comment, only: %i[destroy]
def create
@tweet = Tweet.find(params[:tweet_id])
@comment = current_user.comments.new(comment_params)
@comment.tweet_id = @tweet.id
@comments = @tweet.comments
@co... |
class Category < ApplicationRecord
validates :name, uniqueness: { case_sensitive: false}, presence: true
validates :description, presence: true
has_many :ideas, dependent: :destroy
end
|
class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
def index
@post = Post.new
@posts = Post.all.order(created_at: :desc)
end
def new
@post = PostsTag.new
end
def create
@post = PostsTag.new(post_params)
if @post.valid?
... |
module TinyCI
module Scheduler
class MessageQueue
class Message
attr_accessor :command, :build
def initialize(command, build)
@command, @build = command, build
end
end
def push(command, build)
messages << Message.new(command, build)
... |
class RemoveNameFromLineItems < ActiveRecord::Migration
def change
remove_column :line_items, :name, :string
remove_column :line_items, :price, :decimal
remove_column :line_items, :description, :string
remove_column :line_items, :slot, :string
remove_column :line_items, :weight, :decimal
remov... |
class CoinValuesController < ApplicationController
def create
@coin_value= CoinValue.new(coin_value_params)
end
private
def coin_value_params
params.require(:coin_value).permit(:historical_price)
end
end
|
#!/usr/bin/env ruby
require "fileutils"
require "pathname"
require "yaml"
include FileUtils
Dir["content/posts/*"].each do |post|
open(post) do |f|
f.readline # discard first YAML separator
lines = ""
while (line = f.readline) != "-----\n"
lines << line
end
metadata = YAM... |
class AbuseReport
include MongoMapper::EmbeddedDocument
embedded_in :user
belongs_to :request, :foreign_key => :request_id, :class_name => "Request"
belongs_to :blind, :foreign_key => :blind_id, :class_name => "Blind"
key :reason, String, :required => true
key :reporter, String, :required => true
timestam... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :null_session
before_action :authenticate
def authenticate
authenticate_or_request_with_http_basic("Restrict") do |email, password|
@current_user = User.find_by(email: email)
@current_user&.authenticate(password)
... |
class AddEpubUrlToArticles < ActiveRecord::Migration
def change
add_column :articles, :epub_url, :text
end
end
|
require 'mongoid_taggable'
module MongoidActivityTracker
class Event
include Mongoid::Document
include Mongoid::Timestamps
field :author
field :description
field :action
field :resource_name
field :resource_url
end
end
|
require "fog/core/collection"
require "fog/brkt/models/compute/server"
module Fog
module Compute
class Brkt
class Servers < Fog::Collection
model Fog::Compute::Brkt::Server
# @return [Workload]
attr_accessor :workload
# Get servers.
# If {#workload} attribute is se... |
# 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 Fog
module Softlayer
class Storage
class Mock
def delete_container(name)
response = Excon::Response.new
if @containers[name].nil? # Container doesn't exist.
response.body = '<html><h1>Not Found</h1><p>The resource could not be found.</p></html>'
res... |
module FrequencyUnit
extend ActiveSupport::Concern
included do
enum unit: [:hour]
end
end |
module Omniauthable
extend ActiveSupport::Concern
included do
has_many :authorizations
def self.find_for_oauth(auth)
authorization = Authorization.where(provider: auth.provider, uid: auth.uid.to_s).first
return authorization.user if authorization
auth.info.try(:email) ? (email = auth.i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.