text stringlengths 10 2.61M |
|---|
class Depositor < ActiveRecord::Base
has_secure_password
has_many :deposits
has_many :depositor_collection_pairings, dependent: :destroy
has_many :collections, through: :depositor_collection_pairings
def Depositor.create_password_digest password
cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engin... |
require 'irb/completion'
require 'irb/ext/save-history'
# irb conf
IRB.conf[:AUTO_INDENT] = true
# irb history
IRB.conf[:EVAL_HISTORY] = 1000
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = File::expand_path("~/.irbhistory")
# IRB Prompt inspired by @the-spectator
# https://dev.to/thespectator/making-your-r... |
module OperaWatir
class QuickDropdown < QuickEditField #QuickWidget
# @private
# Checks the type of the widget is correct
def correct_type?
@element.getType == WIDGET_ENUM_MAP[:dropdown]
end
######################################################################
# Checks if the item... |
#
# Github_PR default interactions (filter and action classes)
#
# github_pr.rb first requires this default.rb file,
# then all files in the interaction_dirs that match "ia_*.rb" (ia = interaction)
# The interaction_dirs can be defined in the yaml config as:
# interaction_dirs:
# - ./dir1
# - /other/dir2
# or... |
# frozen_string_literal: true
class ProductsController < ApplicationController
before_action :clean_product_database, only: :update
before_action :find_query_results, only: %i[products categories]
def update
@errors = []
products_params[:products].each do |product_params|
product = Product.new(pro... |
# frozen_string_literal: true
module Might
class FetcherError < StandardError
end
end
|
# frozen_string_literal: true
# DoubleTranspositionCipher
module DoubleTranspositionCipher
def self.encrypt(document, key)
# TODO: FILL THIS IN!
## Suggested steps for double transposition cipher
# 1. find number of rows/cols such that matrix is almost square
words = document.to_s.split('')
words... |
class Admin::BaseController < ApplicationController
layout 'admin'
def admin_authorize
redirect_to '/login' unless current_user
end
end |
require 'protip/transformers/big_decimal_transformer'
require 'protip/transformers/decorating_transformer'
require 'protip/transformers/delegating_transformer'
require 'protip/transformers/deprecated_transformer'
require 'protip/transformers/enum_transformer'
require 'protip/transformers/primitives_transformer'
module... |
module PrintTableGroup
def group_title_data(qgroup)
[[qgroup.group_order, qgroup.text]]
end
def group_title_options
{
:column_widths => [5.mm, 185.mm],
:cell_style => {:padding => [2.mm, 0.mm, 2.mm, 0.mm], :border_width => [0,0,0,0], :size => 8, :align => :left, :font_style => :bold}
... |
module Lolita
class ModelName
def initialize(given_class)
@klass = given_class
@class_name = @klass.to_s
end
def human(options={})
name = if defined?(ActiveRecord::Base) && @klass.ancestors.include?(ActiveRecord::Base)
"activerecord.models.#{@class_name.underscore}"
else
... |
require 'rails_helper'
RSpec.describe TribeImporter do
let(:service) { described_class.new }
let(:users_response) do
[
{"id" => 1}
]
end
let(:id){ users_response.first["id"] }
let(:user_response) do
{
"id" => 1,
"email" => "hello@clio.com",
"employee_record" => employee_... |
require 'formula'
class Gappa < Formula
homepage 'http://gappa.gforge.inria.fr'
url 'https://gforge.inria.fr/frs/download.php/file/34154/gappa-1.1.2.tar.gz'
sha256 '597f58d38ffb0c025352763a387425242723045f398ab2ad65d6f5f61b13681a'
depends_on "gmp"
depends_on "mpfr"
depends_on "boost"
def install
sy... |
class Guide < ApplicationRecord
has_and_belongs_to_many :languages
has_and_belongs_to_many :activities, join_table: :guides_activities
has_many :reviews
validates_uniqueness_of :email
def display_languages
languages.collect(&:code).join(", ")
end
def display_activities
activities.collect(&:name... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :null_session
private
def check_jwt_token
jwt_token = request.headers[:HTTP_AUTHORIZATION].split(" ")[1]
secret = User::SECRET_KEY_FOR_JWT
decoded_info = JWT.decode(jwt_token, secret, true, { algorithm: 'HS256' }).first... |
module Fitter
module Entities
class Step < ROM::Struct
attribute :id, Dry::Types['integer']
attribute :exercise_type_id, Dry::Types['integer']
attribute :name, Dry::Types['string']
attribute :index, Dry::Types['integer']
end
end
end
|
describe Ncr::WorkOrderDecorator do
describe "#current_approver_email_address" do
it "returns NOT FOUND string when WorkOrder has no approvers" do
wo = create(:ncr_work_order).decorate
expect(wo.current_approver_email_address).to eq(Ncr::WorkOrderDecorator::NO_APPROVER_FOUND)
end
it "returns ... |
class HousingHistoriesController < ApplicationController
before_action :load_application
def new
@housing_history = @application.housing_histories.build
end
def create
@housing_history = @application.housing_histories.create(housing_history_params)
respond_to do |format|
if @application.sa... |
json.array!(@vendors) do |vendor|
json.extract! vendor, :id, :name, :username, :password, :city, :street, :zip, :phone, :created_at, :updated_at
json.url vendor_url(vendor, format: :json)
end
|
#Create a Person class
class Person
#Make it so name cannot be changed
attr_reader :name, :happiness, :hygiene
attr_accessor :bank_account
#initialize the attributes we MUST define
def initialize(name)
@name = name
@bank_account = 25
@happiness = 8
@hygiene = 8
end
#set a happiness limit... |
class AddBaseFieldToPartner < ActiveRecord::Migration[5.0]
def change
add_column :partners, :email, :string
add_column :partners, :status, :tinyint
add_column :partners, :mobile, :string
add_index :partners, :email, unique: true
end
end
|
FactoryBot.define do
factory :task do
complexity { 1 }
priority { 1 }
end
trait :invalid do
complexity { 0 }
priority { nil }
end
end
|
require 'rails_helper'
require 'capybara/poltergeist'
feature 'User can delete a question', %Q{
As a user
I want to delete a question
So that I can delete duplicate questions
} do
# Acceptance Criteria
#
# - I must be able delete a question from the question edit page
# - I must be able delete a question from ... |
class AddColumnToParticipation < ActiveRecord::Migration
def change
add_column :participations, :testTitle, :text
end
end
|
class TradePostSerializer < ActiveModel::Serializer
attributes :id, :title, :description, :status
has_many :trade_offers
has_one :requested_pokemon
belongs_to :pokemon
end |
require_relative '../helpers/alec_sequences'
require 'prime'
class A270536Builder
def self.sequence(terms, seed)
AlecSequences.generate(terms, :+, e = 0, seed) do |a_i, n|
!Prime.prime?(a_i + n)
end
end
end
class OEIS
@@a270536 = A270536Builder.sequence(1, [0])
def self.a270536(n)
raise "A2... |
# frozen_string_literal: true
RSpec.shared_examples :service do
describe '#client' do
subject { service.client }
before { allow(service).to receive(:wsdl_url) }
it 'creates a client' do
expect(MondialRelay::Client)
.to receive(:new)
.with(service.wsdl_url)
.once
sub... |
require('minitest/autorun')
require('minitest/rg')
require_relative('../fish')
require_relative('../bear')
require_relative('../river')
class TestRiver < MiniTest::Test
def setup()
@fish1 = Fish.new("Nemo")
@fish2 = Fish.new("Dory")
@fish3 = Fish.new("Marlin")
@fish4 = Fish.new("Gill")
@fish5 = ... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
rescue_from CanCan::AccessDenied do
redirect_to main_app.root_url, notice: t('errors.messages.access_denied')
end
end
|
class OrderItemsController < ApplicationController
include UsersHelper
before_action :set_order_item, only: [:show, :edit, :update, :destroy]
before_action :require_user
# GET /order_items
# GET /order_items.json
def index
@order_items = OrderItem.all
end
# GET /order_items/1
# GET /order_items... |
# 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 UsersController < ApplicationController
def index
@users = User.all
end
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
flash[:notice] = "User Saved"
redirect_to users_path(@user)
else
flash[:error] = "Failded to save!"
render 'new'
end
end
d... |
=begin
Author: Tom Murphy
Last Modified: 2019-11-21 17:28
=end
# https://edabit.com/challenge/xmyZzaKiouqqzsCZz
# Current Streak
=begin
Create a function that takes the current date (e.g. "2019-09-30"), an array of date hashes and returns the "current streak" (i.e. number of consecutive days in a row).
... |
module Ruby
module HL7
class PID < Segment
weight 1
add_field :set_id
add_field :patient_id, :idx => 3, :subidx => 0
add_field :patient_id_list
add_field :alt_patient_id
add_field :patient_name, :idx => 5
add_field :patient_familyname, :idx => 5, :subidx => 0
add_f... |
# frozen_string_literal: true
RSpec.describe HomePage do
describe TopMenu do
context 'when not logged in' do
specify 'guest buttons are there' do
HomePage.open do
expect(top_menu).to be_visible
expect(top_menu.home_link).to be_visible
expect(top_menu.sign_in_link).to b... |
#!/usr/bin/env ruby
# (c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org>
# Utility for adding a Table to a repository
require 'plan-r/application/cli'
require 'plan-r/repo'
require 'plan-r/document/table'
class App < PlanR::CliApplication
def handle_options(args)
@options.repo = nil
@options.dest... |
module DataGenerator
module Field
class Base
attr_reader :label, :mutations
def initialize(attrs = {})
@label = attrs.fetch('label')
@mutations = if attrs['mutations'].present?
attrs['mutations'].collect { |m| load_mutation(m) }
else
[]
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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
require 'pry'
class Computer
InfiniteLoopError = Class.new(StandardError)
attr_reader :accumulator
def initialize(program)
@program = program
@accumulator = 0
@pointer = 0
@previous_instructions = []
end
# Runs the program until it terminates
def run
while (@pointer < program.size)
... |
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the DashboardsHelper. For example:
#
# describe DashboardsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# en... |
class AddTipoDeEstacionamientoToPropiedades < ActiveRecord::Migration
def change
add_column :propiedades, :tipo_de_estacionamiento, :integer, after: :estacionamiento, :limit => 1
end
end
|
include_recipe "monit"
include_recipe "nise_bosh"
ruby_path = File.join(node[:nise_bosh][:ruby][:prefix_path])
bundle_path = File.join(ruby_path, 'bin', 'bundle')
bosh_path = File.join(ruby_path, 'bin', 'bosh')
git node.nise_bosh.release.dir do
repository node.nise_bosh.release.repository
revision node.nise_b... |
require 'spec_helper'
describe Folder do
before(:each) do
@blank_attr={:name=>"",:todouser_id=>""}
end
it "should reject folders with no name" do
@blank_folder = Folder.new(@blank_attr.merge(:todouser_id=>5))
@blank_folder.should_not be_valid
end
it "should reject users with no password" do
... |
class Bankunit < ActiveRecord::Base
has_many :filials
belongs_to :city
end
|
class Renting < ActiveRecord::Base
belongs_to :customer
belongs_to :auto
has_many :payments
attr_accessible :customer_id, :auto_id, :count_of_day, :start_date, :finish_date
validates_presence_of :customer_id, :auto_id, :count_of_day, :start_date, :finish_date
def name
"#{auto.name} | #{count_of_day}... |
# 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 ApplicationHelper
def humanize(secs)
[[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map{ |count, name|
if secs > 0
secs, n = secs.divmod(count)
"#{n.to_i} #{name}"
end
}.compact.reverse.first
end
def trim(num)
i, f = num.to_i, num.to_f
i == f ? i ... |
class User < ApplicationRecord
mount_uploader :avatar, AvatarUploader
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable, :lockable
validates :full_name, presence: true
has_many :posts
has_many :comments
has_many :ratings
end
|
require 'spec_helper'
require './second'
describe 'Second' do
it 'creates array from tree ordered from top to bottom' do
TreeNode = Struct.new(:value, :left, :right)
tree = TreeNode.new(0,
TreeNode.new(1,
nil,
T... |
# frozen_string_literal: true
# == Schema Information
#
# Table name: likes
#
# id :integer not null, primary key
# likeable_type :string
# likeable_id :integer
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# slug :s... |
class Restaurant < ApplicationRecord
mount_uploader :image, PhotoUploader
validates_presence_of :name
belongs_to :category, optional: true
end
|
class MediflectionsController < ApplicationController
before_action :set_mediflection, only: [:show, :edit, :update, :destroy]
def index
# render json: User.find(1).mediflections.all
@mediflections = current_user.mediflections.all
end
def create
@mediflection = current_user.mediflections.create(me... |
# for sending the request
require "uri"
require "net/http"
require "json"
# for loading our environment variables
require "dotenv/load"
# for scraping our blog
require "open-uri"
require "nokogiri"
root = "https://elliott-king.github.io"
page = "/2020/10/medium_api_images/"
doc = Nokogiri::HTML(URI.open(root + page)... |
class Admin::PatientsController < Admin::BaseController
layout 'admin/layouts/index_layout', only: [:index, :sort]
rescue_from ActiveRecord::RecordNotFound, with: :invalid_patient
def sort
@current_patients = Patient.all.order(name: :asc)
render :index
end
def index
# refactor this into locales ... |
require 'test_helper'
class ArraysIndexTest < ActionDispatch::IntegrationTest
def setup
@admin = users(:admin)
end
test "index" do
log_in_as @admin
get resource_storage_arrays_path
assert_template "resource/storage/arrays/index"
Resource::Storage::Array.all.each do |array|
assert... |
class AddLotLabelToPoReceipt < ActiveRecord::Migration
def change
add_column :po_receipt, :lot_label, :string, default: ' '
add_index :po_receipt, [:lot_label, :vtweg]
end
end
|
require 'rails_helper'
describe Post, type: :model do
describe 'confirms validations for post model' do
describe '.validations' do
it { should validate_presence_of(:title) }
it { should validate_presence_of(:post) }
end
end
end
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe XmlUtilities do
specify "fetch_url should throw an exception if it can't reach a site with fetch_url" do
url = 'http://bogus.uits.indiana.edu'
lambda {
XmlUtilities.fetch_url(url)
}.should raise_error SocketError
end
... |
require 'pathname'
require 'fileutils'
require 'json'
require 'crowdin-api'
require 'zip'
require 'rake'
PATTERN = /\[%\s*(.*?)\s*%\]/
module ChampionFX
module Task
class I18n
class << self
def define
task = new
yield(task) if block_given?
task.define
end
... |
require 'colored'
require 'grit'
require 'git-squash/version'
class GitSquash
attr_accessor :argv
def run(argv)
@argv = argv
reset_command
add_command
commit_command
push_force_command
end
private
def push_force_command
puts "Executing push command".green
puts "git push origin ... |
Rails.application.routes.draw do
# # Serve websocket cable requests in-process
#mount ActionCable.server => '/cable'
namespace :api do
get '/cards' => 'cards#index'
get '/users' => 'users#index'
get '/mycards' => 'my_cards#index'
end
get '/' => 'games#index'
get '/signup' => 'users#new'
... |
# frozen_string_literal: true
RSpec.describe BattingAverage, '#average' do
it 'returns average with 3 decimal values' do
expect(described_class.new.average(4, 3)).to eq '1.333'
end
context 'when divider is zero' do
it 'returns zero' do
expect(described_class.new.average(4, 0)).to eq '0.000'
en... |
require File.expand_path(File.dirname(__FILE__) + '/../acceptance_helper')
require 'pry'
feature "Dashboard Articles" do
background do
log_in_as_administrator
@article = FactoryGirl.create(:article)
end
scenario "Create a Article" do
issue = @article.issue
section = issue.sections.first
c... |
class UsersController < ApplicationController
def show
@page_title = user.name
end
protected
def user
@user ||= User.find_by_id(params[:id])
end
helper_method :user
end
|
# frozen_string_literal: true
module GraphQL
class Schema
# Extend this class to define GraphQL enums in your schema.
#
# By default, GraphQL enum values are translated into Ruby strings.
# You can provide a custom value with the `value:` keyword.
#
# @example
# # equivalent to
# ... |
class Contact < ActiveRecord::Base
# 複数項目をまとめてバリデーション設定するのは下記標記でOK??
validates :title,:email,:content, presence: true
end
|
#!/usr/bin/env ruby
require "salary_summary"
include SalarySummary
dm = Persisty::DocumentManager.new
@repository = dm.repository_for(Entities::Salary)
@table_builder = Builders::TableBuilder.new(@repository)
@information = ''
COMMANDS = {
salary: "enter salary\n",
table: "print table\n",
expo... |
class MoviesController < ApplicationController
def index
@movies = Movie.all.limit(10)
end
def show
id = ( params[:id] || 1 )
@movie = Movie.find(id)
end
def search
server = Stretcher::Server.new('http://localhost:9200')
query = {query_string: { query: params[:q], fields: ['title', 'di... |
# rake db:drop && rake db:create && rake db:migrate && rake db:seed && rake sync:pages
namespace :init do
desc "Firstly create db"
task :create => [ "db:create", "db:migrate" ]
desc "recreate db and fill initial data"
task :recreate => [ "db:drop", "init:create" ]
end |
FactoryBot.define do
factory :item do
name { Faker::Lorem.words(number: 6) }
price { '2000' }
description { Faker::Lorem.words(number: 20) }
category_id { '2' }
condition_id { '2' }
shipping_payer_id { '2' }
shipping_from_area_id { '2' }
shipping_duration_id { '2' }
association :us... |
class DebatesController < ApplicationController
before_action :set_debate, only: [:show, :edit, :update, :destroy, :accept_challenge, :schedule, :notify_followers, :share_times_with_opponent, :skip_to_results, :share_challenge, :submit_negative_opening]
before_action :authenticate_user!, except: [:show, :index, :la... |
class HashtagsController < ApplicationController
before_action only: [:index, :edit, :update, :destroy]
def show
@hashtag = Hashtag.find(params[:id])
end
def index
@hashtag = Hashtag.new
@hashtags = Hashtag.paginate(page: params[:page], per_page: 3)
@q = Hashtag.ransack(params[:q])
@hashtag... |
class ChangeIncomeToFloat < ActiveRecord::Migration
def up
change_column :taxpayers, :income, :float
end
def down
change_column :taxpayers, :income, :integer
end
end
|
class CreateDatTaskusers < ActiveRecord::Migration
def self.up
create_table :dat_taskusers do |t|
t.integer "task_id", :null => false
t.integer "projectuser_id", :null => false
t.integer "create_user_id", :null => false
t.datetime "created_on", :null => false
end
end
... |
class AddRegisteredAtAndActivatedAtToMerchants < ActiveRecord::Migration
def change
add_column :merchants, :registered_at, :datetime
add_column :merchants, :activated_at, :datetime
end
end
|
# encoding: utf-8
#
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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 without limitation the rights
#... |
require 'workling/remote/runners/base'
#
# Use Ara Howards BackgroundJob to run the work. BackgroundJob loads Rails once per requested Job.
# It persists over the database, and there is no requirement for separate processes to be started.
# Since rails has to load before each request, it takes a moment for the jo... |
class Item < ApplicationRecord
belongs_to :list
validates_presence_of :name
after_save :update_list
private
def update_list
list.update_complete
end
end
|
require 'rails_helper'
feature "Venmo profile" do
given!(:user) { create(:user) }
background do
login user
visit edit_user_registration_path
end
context "As a logged in user" do
scenario "I can see my profile attributes" do
user_name = find(:css, "#user_name").value
email = find(:css,... |
class TodoCell < Apotomo::StatefulWidget
# :list is a "loop state" and will not walk to another state per default.
transition :in => :list
transition :from => :new, :to => :create
transition :in => :create
transition :from => :trashbin, :to => :delete
# listing things ------------------------------... |
json.array!(@pois) do |poi|
json.id poi.id
json.lat poi.gps_latitude
json.lng poi.gps_longitude
end |
require "test_helper"
require "reform/form/coercion"
class CoercionTest < BaseTest
subject do
Class.new(Reform::Form) do
include Reform::Form::Coercion
property :released_at, :type => DateTime
property :hit do
property :length, :type => Integer
property :good, :type => Virtu... |
# Copyright (c) 2009-2011 VMware, Inc.
require 'fileutils'
require 'redis'
require 'base64'
require 'postgresql_service/common'
require 'postgresql_service/job'
class VCAP::Services::Postgresql::Provisioner < VCAP::Services::Base::Provisioner
include VCAP::Services::Postgresql::Common
def create_snapshot_job
... |
Pod::Spec.new do |s|
s.name = 'QuietModemKit'
s.version = '0.0.1'
s.summary = 'Ill be your wingman anytime.'
s.homepage = 'https://github.com/mitdre/'
s.author = { 'mdrew' => 'mitch.drew@moovel.com' }
s.license = { :type => 'Apache-... |
# == Schema Information
#
# Table name: descriptions
#
# description_code :integer primary key
# language_code :integer
# description_group :integer
# description_text :string(255)
# short_description_text :string(255)
#
class Description < ActiveRecord::Base
attr_accessible :... |
module EM::Xmpp
JID = Struct.new(:node, :domain, :resource) do
def self.parse(str)
s1,s2 = str.split('@',2)
if s2.nil?
s1,s3 = s1.split('/',2)
self.new(nil, s1, s3)
else
s2,s3 = s2.split('/',2)
self.new(s1,s2,s3)
end
end
def bare
if node
... |
# encoding: utf-8
# from TI Georgia: https://github.com/tigeorgia/georgian-language-toolkit
# Add additional Georgian language functionality to String class
####################################
#### Additional instance methods ###
####################################
# def latinize(map = LANG_MAP_TO_GEO)
# def georgia... |
require_relative 'lib/active_snapshot/version'
Gem::Specification.new do |s|
s.name = "active_snapshot"
s.version = ActiveSnapshot::VERSION
s.authors = ["Weston Ganger"]
s.email = ["weston@westonganger.com"]
s.summary = "Dead simple snapshot versioning for ActiveRecord mod... |
class Geocodize::Lookups::Base
PER_SECOND = 1
def self.descendants
ObjectSpace.each_object(Class).select { |klass| klass < self }
end
def self.if_open_then_use
true
end
def self.get_per_second
PER_SECOND
end
def self.lookup_address(address)
{lat: nil, lon: nil}
end
de... |
module Momo
class Manager
attr_accessor :on_motion
def initialize(params = {})
params.each { |key, value| send("#{key}=", value) }
self
end
def on_motion=(on_motion)
fail(ArgumentError, "Must provide proc") unless on_motion.is_a?(Proc)
@on_motion = on_motion
end
def ... |
class Booking < ApplicationRecord
belongs_to :chef
belongs_to :user
has_one :review
validates :chef_id, :user_id, :price, :date, presence: :true
end
|
class SubscribersController < AuthenticatedController
helper_method :sort_column, :sort_direction
def initialize
super
@show_breadcrum = true
add_breadcrumb "Reminders", :schedules_path
end
# GET /subscribers
# GET /subscribers.xml
def index
add_breadcrumb Schedule.find(params[:sc... |
ActiveAdmin.register_page "Dashboard" do
menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }
content title: proc{ I18n.t("active_admin.dashboard") } do
div class: "blank_slate_container", id: "dashboard_default_message" do
span class: "blank_slate" do
span I18n.t("active_admin.dash... |
class ApiInternal::PackagesController < ApiInternal::ApplicationController
include ActionController::Live
def index
# Sort agent ids by number of entities
render json: Agent
.left_outer_joins(:entities_lists)
.group(:id)
.order(Arel.sql 'SUM(entities_lists.entities_count) DESC, agen... |
require 'test_helper'
class PlayerMatchesControllerTest < ActionDispatch::IntegrationTest
setup do
@player_match = player_matches(:one)
end
test "should get index" do
get player_matches_url, as: :json
assert_response :success
end
test "should create player_match" do
assert_difference('Playe... |
require "spec_helper"
describe "31170585 has_flow_states requires states be unique" do
it "Does not raise exception if all states unique" do
expect do
class Foo < Sample
has_sage_flow_states :foo, :bar
end
end.not_to raise_error
end
it "Raises exception if there is one duplicate st... |
module Graph
class NodeEdges
attr_reader :node
def initialize(node, filters=[])
@node = node
@edges = Set.new
@filters = Set.new filters
end
def initialize_copy(source)
super
@filters = source.filters.clone
end
def unfiltered
@edges.clone
end
de... |
# variables_01.rb
hello_string = "Hello, world !" |
class AdminUser < ActiveRecord::Base
has_secure_password
has_many :specialoffers
has_many :menuitems
has_many :menu_categories
has_many :chmenus
EMAIL_REGEX = /\A[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}\Z/i
# shortcut validations, aka "sexy validations"
validates :username, :length => { :within => 8..25 },
... |
require 'logger'
module Scaffold
# Provides an extended Ruby logger to provide a default logging class, with a
# default log retention and output format.
class Log < Logger
attr_writer :level
# Initialize the parent log object.
# Params:
# +destination+:: The log destination (file, or STDOUT).
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.