text stringlengths 10 2.61M |
|---|
class CreateStallions < ActiveRecord::Migration[5.0]
def change
create_table :stallions do |t|
t.string :name
t.integer :age
t.string :color
t.string :registry_tattoo
t.string :link_to_pedigree_url
t.string :img_url
t.decimal :stud_fee
t.integer :stakes_winner_proge... |
# frozen_string_literal: true
module Brcobranca
module Remessa
module Cnab400
class Santander < Brcobranca::Remessa::Cnab400::Base
# Código de Transmissão
# Consultar seu gerente para pegar esse código. Geralmente está no e-mail enviado pelo banco.
attr_accessor :codigo_transmissao
... |
module Globalize
mattr_accessor :available_locales
def self.valid_locale?(loc)
return false unless loc
available_locales.include?(loc.to_sym)
end
end
Globalize::ActiveRecord::ClassMethods.module_eval do
def translations_accessor_with_locale_suffix_accessors(name)
translations_accessor_without_loca... |
# @author Ido Efrati
class SessionsController < ApplicationController
# Checks if user already signed in (i.e there is a session). If there is a session the user will be redirected to his/her notes
# else the user will be redirected to login page
def new
if signed_in?
redirect_to trips_path
end
... |
require_relative 'gimme_proxy.rb'
require_relative 'proxy_store.rb'
require_relative 'proxy_verifier.rb'
class ProxyFinder
DEFAULT_ATTEMPTS_LIMIT = 8
PROXY_STORE = ProxyStore.new('.seed_proxies')
PTC_VERIFIER = PTCProxyVerifier.new
NIANTIC_VERIFIER = NianticProxyVerifier.new
def s... |
class PostsController < ApplicationController
def index
@post = Post.all()
end
def edit
@post = Post.find(params[:id])
end
def update
@post = Post.find(params[:id])
if(@post.update(posts_params))
redirect_to @post # this will redirect it to show... |
# adventure_worker.rb
class AdventuresWorker
include Sidekiq::Worker
def get_adventures id
library = Library.find(id)
if library
request = Typhoeus.get(library.url+"/adventures.json")
result = JSON.parse(request.body)
if result
result['adventures'].each do |adventure|
ex... |
class DepartmentsController < ApplicationController
# GET /departments
def index
@departments = Department.all
render json: @departments
end
end
|
require "zlib"
require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../../fixtures/class'
require File.dirname(__FILE__) + '/fixtures/classes'
describe "Zlib::GzipReader.wrap" do
before :each do
@io = ClassSpecs::StubReaderWithClose.new GzipReaderSpecs::GzippedLoremIpsum... |
require_dependency 'annotable/application_controller'
module Annotable
class ReportsController < ApplicationController
before_action :organization
before_action :set_report, only: %i[show update destroy].freeze
class << self
# Define which resources are the authorized to be included
# @retur... |
# frozen_string_literal: true
class OrganizationsPresenter < BasePresenter
attr_reader :organizations
def initialize(organizations, params, current_user)
@organizations = organizations
@params = params
@current_user = current_user
end
def events_count(organization)
events(organization).size
... |
class StudyPassagesController < ApplicationController
before_action :set_study_passage, only: [:show, :edit, :update, :destroy]
# GET /study_passages
# GET /study_passages.json
def index
@study_passages = StudyPassage.all
end
# GET /study_passages/1
# GET /study_passages/1.json
def show
end
#... |
class Genre < ActiveRecord::Base
validates :name, presence: true, uniqueness: true
has_many :characterizations, dependent: :destroy
has_many :movies, through: :characterizations
end
|
require 'spec_helper'
describe Game do
it { should have_many(:players).through(:game_players) }
it { should have_many(:comments) }
it "saves itself" do
game = Game.new(location: "Seward Park", price: 15, daytime: Time.now)
game.save
expect(Game.first).to eq(game)
end
it "does not save a game with... |
# 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 Voted
extend ActiveSupport::Concern
def create_vote
@object = controller_name.classify.constantize.find(params[:id])
authorize! :create_vote, @object
@vote = @object.vote(current_user, params[:value])
respond_to do |format|
format.json { render json: { vote: @vote, rating: @object.rati... |
class ModuloCalificadasController < ApplicationController
before_action :set_modulo_calificada, only: [:show, :edit, :update, :destroy]
respond_to :html, :xml, :json
def index
@modulo_calificadas = ModuloCalificada.all
respond_with(@modulo_calificadas)
end
def show
respond_with(@modulo_calificad... |
require 'user'
describe User do
it 'can be create a new user' do
user = User.add(name: 'user1', username: 'user100', email: 'user1@gmail.com', password: '123')
expect(user.name).to eq 'user1'
end
it 'should be able to list all the user' do
expect { User.add(name: 'user1', username: 'user100', email:... |
# 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... |
# TODO: cash_transactions probably needs to be a model of its own.
class User < ActiveRecord::Base
include Uuid
include Persona
include Notify::Receiver
has_many :identities
belongs_to :partner
has_many :tips
has_many :purchases
has_many :withdrawals
has_one :reputation
has_many :sales, through: :t... |
class User < ApplicationRecord
has_many :lists
has_many :tasks
def self.guest
find_or_create_by!(nickname: 'ゲスト', email: 'guest@example.com') do |user|
user.password = SecureRandom.urlsafe_base64
end
end
# Include default devise modules. Others available are:
# :confirmable, :lockable, :ti... |
class AddFileFieldsToAvatarVideos < ActiveRecord::Migration
def change
add_column :avatar_videos, :media_type, :string, null: false
add_column :avatar_videos, :content_type, :string, null: false
add_column :avatar_videos, :file_size, :integer, null: false
add_column :avatar_videos, :preview_width, :in... |
namespace :easyproject do
namespace :easy_money do
desc <<-END_DESC
Recalculates time entry expenses on project
Example:
bundle exec rake easyproject:easy_money:recalculate_time_entry_expenses_on_project RAILS_ENV=production
END_DESC
task :recalculate_time_entry_expenses_on_project => :en... |
class CommentsController < ApplicationController
def new
@speak = Speak.find(params[:speak_id])
@comment = Comment.new
@comment.speak_id = @speak.id
end
def create
@comment = Comment.create(create_params)
end
def destroy
@comment = Comment.find(params[:id])
if ad_user_signed_in?... |
# coding: utf-8
require_relative "sha256lib.rb"
# ---------
# Constants - K
# ---------
# SHA256 uses the same sequence of sixty-four constant 32-bit words.
#
# These words represent the first thirty-two bits of the fractional parts of the cube roots of the first sixty-four prime numbers. These are "nothing up my slee... |
# == Schema Information
#
# Table name: microposts
#
# id :integer not null, primary key
# user_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_microposts_on_user_id_and_created_at (user_id,created_at)
#
# co... |
module HTTP
class Evaluations < Authenticated
OVERALL_PROMPT = 'Overall rating of subject'
RESPONSE_PROMPT = 'Response rate'
METRICS = {
"expectations were clearly defined" => "expectations_clear",
"expectations were made clear" => "expectations_clear",
"learning objectives were met" => ... |
class AddStuffToMAkerStorefronts < ActiveRecord::Migration
def change
add_column :storefronts, :ships, :boolean
add_column :storefronts, :pickup, :boolean
end
end
|
# frozen_string_literal: true
module Quilt
class InstallGenerator < Rails::Generators::Base
def run_all_generators
generate("quilt:rails_setup")
generate("quilt:react_setup")
generate("quilt:react_app")
end
end
end
|
# Given an array of integers, find the first missing positive integer
# in linear time and constant space. In other words, find the lowest
# positive integer that does not exist in the array. The array can
# contain duplicates and negative numbers as well.
# For example, the input [3, 4, -1, 1] should give 2. The i... |
Rails.application.routes.draw do
resources :satellite_trackers, only: [:index]
post '/', to: 'satellite_trackers#index', as: 'satellite_tracker'
end
|
require 'rails_helper'
context "User 1 and User 2 are already playing a game" do
it "does not allow them to begin a new game" do
user_1 = create(:user)
user_2 = create(:user2)
game_1 = Game.create(player_1_board: Board.new(4),
player_2_board: Board.new(4),
... |
# -*- coding: utf-8 -*-
# Send SIP "NOTIFY" "check-sync" events.
require 'socket'
require 'securerandom'
require 'rbconfig'
require 'bindata'
class SipNotifyError < RuntimeError; end
class SipNotify
REQUEST_METHOD = 'NOTIFY'.freeze
VIA_BRANCH_TOKEN_MAGIC = 'z9hG4bK'.freeze # http://tools.ietf.org/html/rfc3261... |
@default_driver = 'phantom.js'
@browsers = %w(phantomjs firefox chrome)
def use_driver(driver)
ENV['DRIVER'] = driver || @default_driver
end
def run(driver, suite)
use_driver driver
puts "Running using #{ENV['DRIVER']}"
system('cucumber -t @' + suite +' -t ~@ignore')
fail 'build failed!' unless $?.exitstatu... |
class Region < ActiveRecord::Base
has_many :station_joins
has_many :profiles, :through => :station_joins
# for named urls
def link_name
self.name.gsub(/\s/,"_").downcase
end
# setup script calls this to associate
# states with profiles.
def create_profile_for(profile_name)
prof = Prof... |
# 引数に対する依存を取り除く
class Gear
attr_reader :chainring, :cog, :wheel
def initialize(args)
@chainring = args[:chainring]
@cog = args[:cog]
@wheel = args[:wheel]
end
end
Gear.new(
:chainring => 52,
:cog => 11,
:wheel => Wheel.new(26, 1.5).gear_inches
# Gearが外部インターフェースの一部分
module SomeFramewo... |
class CreateDecision1s < ActiveRecord::Migration
def change
create_table :decision1s do |t|
t.string :d5
t.string :d6
t.references :decision, index: true, foreign_key: true
t.timestamps null: false
end
end
end
|
class Wishlist < ApplicationRecord
belongs_to :person, foreign_key: "person_id", class_name: "Person"
end
|
json.videos @videos do |video|
json.id video.id
json.title video.title
json.description video.description
json.url video.url
end
|
require 'rails_helper'
RSpec.describe "host/rooms/show", type: :view do
before(:each) do
@host_room = assign(:host_room, Host::Room.create!)
end
it "renders attributes in <p>" do
render
end
end
|
class Book < ActiveRecord::Base
attr_reader :avatar_remote_url
has_many :book_places, dependent: :destroy
has_many :places, -> { uniq }, through: :book_places
validates :isbn, :isbn_format => true
validates_uniqueness_of :isbn
validates_presence_of :title
has_attached_file :avatar, :styles => { :me... |
require 'spec_helper'
describe "Order Summary" do
context "When I am on the order summary page" do
let!(:user) { Fabricate(:user) }
before(:each) do
login
end
it "shows the shipping address for the order" do
visit new_billing_address_path
fill_in "First name", :with => "Jeff"
... |
class Admin::ProductAnswersController < Admin::BaseController
permit "superuser"
layout 'admin/base'
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [:update],
:redirect_to => { :controller => 'home' }
def list
params[:... |
class CreateFoods < ActiveRecord::Migration[6.1]
def change
create_table :foods do |t|
t.string :name, null: false
t.string :group, null: false
t.text :nutrition
t.integer :calories
t.text :category
t.string :image
t.timestamps
end
end
end
|
class ContactsController < ApplicationController
before_action :authenticate_user!
before_action :redirect_cancel, only: [:create, :update]
def create
params.permit!
@contact = Contact.new(params[:contact])
@contact.user_id = current_user.id
if @contact.save
flash[:notice] = "Contact was s... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Orders::Create, type: :action do
describe 'Inputs' do
subject { described_class.inputs }
it { is_expected.to include(attributes: { type: Hash }) }
end
describe 'Outputs' do
subject { described_class.outputs }
it { is_expected... |
require 'github_api'
module GithubApi
@github = Github.new oauth_token: ENV['GITHUB_TOKEN']
def self.list_releases(owner, repo)
@github.repos.releases.list owner, repo
end
def self.create_release(owner, repo, tag)
@github.repos.releases.create owner, repo, tag,
tag_name: tag,
target... |
class RenameClassesToLectures < ActiveRecord::Migration
def change
rename_table :classes, :lectures
add_column :lectures, :meeting_id, :integer
end
end
|
=begin
Description :
Table of contents.
write a program that will display a table of contents so that it looks like this:
Table of Contents
Chapter 1: Getting Started page 1
Chapter 2: Numbers page 9
Chapter 3: Letters page ... |
require 'test/unit'
class TC_ExceptionTest < Test::Unit::TestCase
def setup
@message = AccountError::NO_ACCOUNT_MESSAGE
@info = AccountError::CONFIGURE_ACCOUNT_INFO
App.stubs(:configure_account)
end
def test_message
err = AccountError.new(@message)
assert_equal(@message, err.message)
er... |
# 5 stars is a common ranking use case. They are not given at specified
# actions like badges, you should define a cron job to test if ranks are to be
# granted.
#
# +set_rank+ accepts:
# * :+level+ ranking level (greater is better)
# * :+to+ model or scope to check if new rankings apply
# * :+level_name+ attribute nam... |
# coding: utf-8
require 'test_helper'
class TasksControllerTest < ActionController::TestCase
fixtures :tasks
setup do
session[:user_id] = users(:one).id
end
test "should get new" do
get :new
assert_response :success
end
test 'should get edit' do
get :edit, id: users(:one)
assert_respons... |
class AddSatAndSunToSchedule < ActiveRecord::Migration
def change
add_column :schedules, :satStart, :time
add_column :schedules, :satEnd, :time
add_column :schedules, :satOpen, :boolean
add_column :schedules, :sunStart, :time
add_column :schedules, :sunEnd, :time
add_column :schedules, :sunOp... |
class RemoveProductAndBankCodes < ActiveRecord::Migration[5.0]
def change
remove_column :card_products, :code, :string, null: false
remove_column :banks, :personal_code, :string, null: false
end
end
|
class CreateCfsFileInfos < ActiveRecord::Migration
def change
create_table :cfs_file_infos do |t|
t.string :path
t.text :fits_xml
t.timestamps
end
add_index :cfs_file_infos, :path, :unique => true
end
end
|
require 'wordnik'
require 'open-uri'
require 'twitter'
Wordnik.configure do |config|
config.api_key = ENV['wordnik_api_key']
end
class BotMeByYourBot
VERB_LIST_URL = 'https://gist.githubusercontent.com/farisj/f2ebb73fabfa20dfc40e7fa9de72ddd8/raw'.freeze
def tweet
phrase = verb + " me by your " + noun + " ... |
# == Schema Information
#
# Table name: companies
#
# id :integer not null, primary key
# company_name :string(255)
# signup_code :string(255)
# owner_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class Company < ActiveRecord::Base
at... |
class User < ApplicationRecord
devise :database_authenticatable, :registerable,
:rememberable, :trackable, :validatable
has_many :bookmarks
belongs_to :user
end
|
require 'json'
require 'pp'
module Ruboty
module Jenkins
module Actions
class Build < Base
def call
build
report
end
private
def build
curl = Curl::Easy.new(ENV["JENKINS_URL"])
curl.http_auth_types = :basic
curl.username = ... |
require 'rake/testtask'
require 'rake/clean'
require 'spec/rake/spectask'
CLOBBER.include('dist')
task :default => [:spec, :dist]
desc 'Package the FlexUtils scripts as a single file'
task :dist => 'dist/flexutils.rb'
file 'dist/flexutils.rb' => ['lib/flexutils/FlexUtils.rb'] + FileList['lib/flexutils/*.rb'].exc... |
require 'rails_helper'
RSpec.describe Integrations::AwardWallet::User::Refresh do
include AwardWalletMacros
include SampleDataMacros
let(:op) { described_class }
let(:account) { create_account(:onboarded) }
let(:owner) { account.owner }
let(:json) { sample_json('award_wallet_user') }
before { stub_a... |
class LocationGraderService
GRADES = %w(A+ A A- B+ B B- C+ C C- D+ D D- F).freeze
WEIGHTS = [2.5, 1.75, 1.25, 1, 0.8, 0.65].freeze
def initialize(location)
@scores = location_item_comments location
end
def grade
divisor = find_divisor
apply_divisor divisor, sum_averages
end
def to_alphabetic... |
require 'rails_helper'
RSpec.describe "Plants", type: :request do
let(:plant1) { create(:plant, light: 6) }
let(:plant2) { create(:plant) }
describe 'GET /plants' do
it 'returns all plants' do
[plant1, plant2]
get '/plants'
expect(response).to have_http_status(200)
expect(json['data... |
require 'brewery_db/webhooks/base'
require 'app/models/location'
module BreweryDB
module Webhooks
class Location < Base
def process
self.send(@action)
end
private
def edit(attributes = nil)
location = ::Location.find_or_initialize_by(brewerydb_id: @brewerydb_id)
... |
require 'rails_helper'
feature 'Create badge' do
background do
create(:video, name: 'Rails1')
end
scenario 'new badge with a min_views condition' do
visit new_badge_url
within 'form' do
fill_in 'badge_name', with: 'Expert'
fill_in 'badge_fa_symbol', with: 'user'
fill_in 'badge_min_... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ereignishorizont/client'
Gem::Specification.new do |spec|
spec.name = "ereignishorizont-client"
spec.version = Ereignishorizont::Client::VERSION
spec.authors = ["Susann... |
require 'spec_helper'
describe DataTypesController do
login_user
let(:data_type) { create(:data_type) }
let(:valid_template) { build(:data_type) }
let(:invalid_template) { build(:data_type, name: nil) }
describe "GET index" do
it "assigns all data_types as @data_types" do
data_types = create_lis... |
require "mengpaneel/delayer"
module Mengpaneel
class Replayer
attr_reader :manager
def initialize(manager)
@manager = manager
end
def run
return unless manager.controller
delayed_calls = Delayer.new(manager.controller).load!
Manager::MODES.each do |mode|
next... |
class IncidentfollowupsController < ApplicationController
before_action :set_incidentfollowup, only: [:show, :edit, :update, :destroy]
# GET /incidentfollowups
# GET /incidentfollowups.json
def index
@incidentfollowups = Incidentfollowup.all
# @incident = Incident.incidentcategory.all
end
# GET /i... |
require 'capybara/rspec'
require 'selenium-webdriver'
RSpec.configure do |config|
config.include Capybara::DSL
end
Capybara.configure do |config|
config.run_server = false
config.default_driver = :selenium
config.app_host = 'https://twitter.com/'
end
Capybara.register_driver :selenium do |app|
Capybara::Seleni... |
# frozen_string_literal: true
puts '**** Running seeds...'
user = User.find_or_create_by!(email: 'admin@email.com') do |user|
user.name = 'admin'
user.password = 'password'
user.password_confirmation = 'password'
user.admin = true
user.save
end
# Post Types
SeedsHelper.count_records_for(PostType) do
name... |
class TemplateOptions < ActiveRecord::Migration
def self.up
add_column :mail_templates, :processor, :string
add_column :mail_templates, :charset, :string
add_column :mail_templates, :content_type, :string
add_column :mail_templates, :reply_to, :string
add_column :mail_templates, :mime_version, :st... |
#
# Basic Dialog allows JQuery UI Widgets to interact
# with the basic dialogs that JQueryUI pops up.
#
# NOTE: JQueryUI Widgets are very customizable,
# so we've kept the functionality for the dialogs
# class as rudimentary as possible, to allow the
# end user to build up any functionality they
# require, and customi... |
require 'rails_helper'
RSpec.describe ListsController, type: :controller do
let(:list) { create(:list)}
describe 'GET #show' do
sign_in_user
before { get :show, id: list }
it 'assigns new remark to @list' do
expect(assigns(:remark)).to be_a_new(Remark)
end
it 'assigns new confirm to @list... |
class TestDescription < ActiveRecord::Base
has_many :test_runs
def summary
@summary ||= description.split("\n").first
end
end
|
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :logs
resources :actions
resources :evaluations
resources :measurements
resources :species
resources :plants
resources :groups
patch "/users/edit", to: "users#update"
resource... |
class Comment < ApplicationRecord
belongs_to :post
belongs_to :user
has_many :replies, class_name: "Comment",foreign_key: "scid"
end
|
# frozen_string_literal: true
Barong::App.define do |config|
config.set(:required_docs_expire, true)
end
|
class MensajesController < ApplicationController
def index
@mensajes = Mensaje.all
end
def update
@mensaje = Mensaje.find([:id])
end
def new
@mensaje = Mensaje.new
end
def create
@mensaje = Mensaje.new(mensaje_params)
@mensaje.save
redirect_to @mensaje
end
def show
@mensaje = Mensaj... |
class AddRtidToEvent < ActiveRecord::Migration
def change
add_column :events, :rt_id, :integer
end
end
|
require "semantic_navigation/version"
require 'semantic_navigation/core'
require 'semantic_navigation/renderers'
require "semantic_navigation/configuration"
require 'semantic_navigation/railtie' if defined?(Rails)
module SemanticNavigation
def self.deprecation_message(type, deprecated_object, new_object, action = ni... |
Spree::Admin::BaseHelper.class_eval do
def delivery_data(order)
info = ""
adr = order.bill_address
info += "#{adr.first_name}, " unless adr.first_name.blank?
info += "#{adr.address1}, " unless adr.address1.blank?
info += "#{adr.phone}, " unless adr.phone.blank?
info += "#{adr.comment} ," unless adr.comment... |
class CodeController < ApplicationController
# GET /
def index
@code = 'Code controller'
respond_to do |format|
format.html # index.html.erb
end
end
# GET /1
def show
@code = 'Code controller with show'
respond_to do |format|
format.html # home#index
end
end
end
|
module ItemsHelper
def full_image_url(image)
if Rails.env.development?
"#{request.protocol}#{request.host.present? ? request.host + ':' : '' }#{request.port}#{image.image.url}" || ''
else
image.image.url
end
end
end
|
MESSAGES = {
auth_error: 'Please log in.',
access_error: 'You do not have access to the requested resource.',
not_found: 'The resource you are looking for does not exist.'
}
|
require 'rails_helper'
RSpec.describe PlayersController, type: :controller do
describe "GET index" do
subject { get :index }
let(:players) { FactoryGirl.create_list :player, 3 }
specify { expect(subject.status).to eq 200 }
it { is_expected.to render_template :index }
it "assigns all players as... |
# == Schema Information
#
# Table name: question_categories
#
# id :integer not null, primary key
# name :string(255)
# created_at :datetime
# updated_at :datetime
# exam_id :integer
#
require 'rails_helper'
RSpec.describe QuestionCategory, :type => :model do
describe 'validation' do
... |
module UsersHelper
include Avatar::View::ActionViewSupport
USERS_DEFAULT_AVATAR = "#{SITE_URL}images/no-avatar.gif"
USERS_DEFAULT_AVATAR_SMALL = "#{SITE_URL}images/no-avatar-small.gif"
def avatar_for(user, args = {})
opts = { :size => 100, :default => USERS_DEFAULT_AVATAR }.update(args)
avata... |
class User #criado uma classe que possui um metodo chamado add e outro chamado hello
def add(name) #adicionado o parametro 'name' ao metodo add
@name = name
puts "User adicionado"
hello
end
def hello
puts "Seja bem vindo, #{@name}!"
end
end
user = User.new
user.add('Joa... |
class Language < ActiveRecord::Base
belongs_to :user
has_many :dictionaries, foreign_key: "language_id", dependent: :destroy
#validation
validates :name, presence: true, length: {maximum: 25}
end
|
class ContactPolicy < ApplicationPolicy
attr_reader :user, :contact
class Scope < Scope
def resolve
scope.all
end
end
def initialize(user, contact)
@user = user
@contact = contact
end
def new?
true
end
def create?
true
end
def edit?
true
end
def update?
true
end
def des... |
# frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe 'Auto Encryption' do
require_libmongocrypt
min_server_fcv '4.2'
require_enterprise
include_context 'define shared FLE helpers'
include_context 'with local kms_providers'
context 'with an invalid mongocryptd spawn path' do
... |
class AttendancesController < ApplicationController
def new
@event = Event.find_by_slug(params[:id])
@user = User.find_by(params[:user_id])
@attendance = Attendance.new
end
def create
if current_user
@attendance = Attendance.new(attendance_params)
@user = User.find_by(params[:user_id... |
class StudentAnswersController < ApplicationController
# GET /student_answers
# GET /student_answers.json
def index
@student_answers = StudentAnswer.all
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @student_answers }
end
end
# GET /student_answers... |
require 'pg'
require 'set'
# IMPORTANT NOTE: change the file path on lines 23 and 324 or the code will not run.
$capitalized_words_and_phrases = {} # this will hold all words and phrases that are capitalized even once
$descriptions_to_correct = [] # this will hold objects corresponding to entries that need correction... |
require 'spec_helper'
require 'jshint'
describe Jshint do
describe ".class methods" do
it "should return the root path of the gem" do
expect(described_class.root).to eq(File.expand_path('../..', __FILE__))
end
end
end
|
require 'csv'
require_relative 'merchant_repository'
require_relative 'merchant'
require_relative 'item_repository'
require_relative 'item'
require_relative 'invoice_repository'
require_relative 'invoice'
require_relative 'transaction'
require_relative 'transaction_repository'
require_relative 'invoice_item_repository'... |
module BlueprintAgreement
class MethodNotFound < StandardError; end
class EndpointNotFound < StandardError
attr :request, :response
def initialize(request)
@request = request
@response = request
end
def message
%{
Response:
uri: #{response.uri}
code:... |
module ApplicationHelper
def modal_dialog
content_tag :div, "",
id: "modal-new-element",
class: "modal fade",
style: "display: none;",
tabindex: "-1"
end
def flash_key key
if key == "notice"
"info"
elsif key == "alert"
"dange... |
class Post < ApplicationRecord
acts_as_votable
belongs_to :user
has_many :comments
has_attached_file :image, styles: { medium: "600x400#", small: "250x150>" }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.