text stringlengths 10 2.61M |
|---|
class Sessions::CreateService
attr_reader :user, :password
def initialize(user:, password:)
@user = user
@password = password
end
def call
end
end
|
class OrderSerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers
attributes :id,
:name,
:invoiced_budget,
:allocatable_budget,
:free_budget,
:suborder,
:paid,
:completed,
:internal_or... |
class Sponsor < ActiveRecord::Base
belongs_to :user
end
# == Schema Info
# Schema version: 20110328181217
#
# Table name: sponsors
#
# id :integer(4) not null, primary key
# name :string(50) not null
# credit :float not null
# telephone :string(50)
# created_at :datetime ... |
json.array! @posts do |post|
json.id post.id
json.author_id post.author_id
json.body post.body
json.profile_pic post.author.profile_pic
end
|
Rails.application.routes.draw do
# The Bawz
root 'articles#index'
# Devise
devise_for :users, path: 'u',
path_names: {
sign_in: 'login',
sign_out: 'logout',
sign_up: 'register' }
# Articles
resources :articles
end
|
# == Schema Information
#
# Table name: final_decisions
#
# id :integer not null, primary key
# decision :string(255)
# decisionable_id :integer
# decisionable_type :string(255)
# created_at :datetime
# updated_at :datetime
#
class FinalDecision < ActiveRecord::Ba... |
class Account::DayDecorator < Draper::Decorator
delegate_all
def saldo
(object.limit_amount - object.random_expenses.sum(&:amount)).format
end
def wasted
if object.random_expenses.any?
object.random_expenses.sum(&:amount)
else
Money.new(0, object.user.default_currency)
end
end
en... |
Rails.application.routes.draw do
resources :items
root to:'items#index'
resources :items_imports, only: [ :new, :create]
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
require 'rails_helper'
describe CommentsController do
let(:user) {create(:user)}
let(:prototype) {create(:prototype)}
let(:capturedImage) {create(:capturedImage, status: 0, prototype_id: prototype.id)}
let(:capturedImage) {create_list(:capturedImage, 3, status: 1, prototype_id: prototype.id)}
describe 'POS... |
require 'spec_helper'
describe User do
it 'has valid factories' do
FactoryGirl.create(:user).should be_valid
FactoryGirl.create(:user_with_alerts).should be_valid
FactoryGirl.create(:admin).should be_valid
end
describe 'username' do
it 'is invalid without a username' do
FactoryGirl.build(:user, username... |
class DateValidator < ActiveModel::Validator
def validate(record)
#If the selected status requires lessons learned, make sure we have some before saving
if record.parent.present? && record.end_date != record.parent.end_date
record.errors[:base] << "End date must match parent end date."
end
end
end... |
class CreateTestModels < ActiveRecord::Migration
def change
create_table :test_models do |t|
t.string :title
t.integer :number
t.string :item_from_a_list
t.float :float_number
t.string :required_field
t.date :date_field
t.timestamps
end
end
end
|
require 'rails_helper'
RSpec.describe 'Sign in a User', type: :feature do
scenario 'create a new event' do
visit new_user_registration_path
fill_in 'Name', with: 'John'
fill_in 'Email', with: 'John@example.com'
fill_in 'Password', with: 'password'
fill_in 'Password confirmation', with: 'password'... |
# frozen_string_literal: true
class AddDeletedAtToSkills < ActiveRecord::Migration[5.0]
def change
add_column :skills, :deleted_at, :datetime
end
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe OrderProduct, type: :model do
describe 'associations' do
subject(:order_product) { build :order_product }
it do
expect(order_product).to belong_to(:order)
expect(order_product).to belong_to(:product)
end
end
end
|
class Activity
class Import
class Creator
attr_reader :errors, :row, :activity
def initialize(row:, uploader:, partner_organisation:, report:, is_oda: nil)
@uploader = uploader
@partner_organisation = partner_organisation
@errors = {}
@row = row
@parent_activit... |
class ApplicationController < ActionController::Base
protect_from_forgery
# Redirects the user/admin after registeration
def after_sign_up_path_for(resource)
root_path
end
# Redirects the user/admin after registeration
def after_sign_in_path_for(resource)
if admin_signed_in?
admin_dashboar... |
require 'test_helper'
class AdvertisingCampaignsControllerTest < ActionController::TestCase
setup do
@advertising_campaign = advertising_campaigns(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:advertising_campaigns)
end
test "should get new... |
# frozen_string_literal: true
module Bridgetown
module Validatable
# FIXME: there should be ONE TRUE METHOD to read the YAML frontmatter
# in the entire project. Both this and the equivalent Document method
# should be extracted and generalized.
#
# Read the YAML frontmatter.
#
# base - T... |
class UserStatsAddGoodPoints < ActiveRecord::Migration
def self.up
add_column :user_stats, :good_points, :integer
end
def self.down
remove_column :user_stats, :good_points
end
end
|
require 'rails_helper'
RSpec.describe 'Surveys API', type: :request do
let(:user) {create(:user)}
let(:valid_attributes) {
{
title: "valid title",
description: "valid description",
user_id: user.id
}
}
let(:invalid_attributes) {{title: "ab", description: 1}}
let(:auth_headers) {use... |
require "rubygems"
require "bundler/setup"
require "csv"
require "./modules/file_validation_helpers"
require "./modules/csv_pivot"
include FileValidator
include CSVPivotable
OUTPUT_HEADERS = [
"violation_category",
"violation_count",
"earliest_violation_date",
"lastest_violation_date"
]
def get_violations_pe... |
module Opener
class PolarityTagger
class LexiconMap
attr_reader :resource
attr_reader :negators
attr_reader :intensifiers
attr_reader :with_polarity
POS_ORDER = 'ONRVGA'
DEFAULT_POS = 'O'
POS_SHORT_MAP = {
adj: 'G',
adv: 'A',
... |
#!/usr/bin/env ruby
# encoding: UTF-8
#
# Copyright © 2012-2015 Cask Data, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
describe ServiceOrderListener do
let(:client) { double(:client) }
describe "#subscribe_to_task_updates" do
around do |example|
ManageIQ::API::Common::Request.with_request(default_request) { example.call }
end
let(:message) { double("ManageIQ::Messaging::ReceivedMessage") }
let(:update_order_... |
class Invitation < ActiveRecord::Base
belongs_to :user
belongs_to :collaboration
validates_uniqueness_of :user_id, scope: [:collaboration_id]
before_validation(on: :create) do
!User.find(self.user_id).all_collaborations.map(&:id).include?(self.collaboration_id)
end
scope :with_collaboration, -> {
... |
class AddArchivedToLists < ActiveRecord::Migration[6.0]
def change
add_column :lists, :archived, :boolean
end
end
|
Fabricator(:relationship_to_children) do
name { sequence(:name) { |i| "Auntie#{i}" } }
end
|
module Api
class ConvertableStruct < ActionWebService::Struct
def initialize hash_or_model={}
if hash_or_model.is_a?(Hash)
super hash_or_model
else
super(common_attributes(hash_or_model.attributes))
end
end
def == other
return false unless other.is_a? self.... |
class Chart < ActiveRecord::Base
has_many :rankings, :dependent => :destroy
has_many :movies, :through => :rankings
validates :created_at, :uniqueness => true
end
|
# frozen_string_literal: true
require 'test_helper'
module Compatibility
class DogStatsDDatagramCompatibilityTest < Minitest::Test
def setup
StatsD::Instrument::UDPSink.any_instance.stubs(:sample?).returns(true)
StatsD::Instrument::Backends::UDPBackend.any_instance.stubs(:rand).returns(0)
@se... |
class RegistrationsController < Devise::RegistrationsController
def create
## To build the resource
build_resource(sign_up_params)
## Verifying Captcha
if verify_recaptcha(model: resource)
super
else
render 'new'
end
end
def sign_up_params
params.require(:user).permit(:passphrase, :... |
class AddFieldToSiteSetting < ActiveRecord::Migration
def change
add_column :site_settings, :pop_up, :boolean
end
end
|
# Get data from twitter
class TwitterIngestionTask
attr_reader :texts
CONFIGURATION_FILENAME = "config/bogus_twitter_pictures_ingestor.yml"
def self.new_using_configuration(twitter_client)
configuration_text = File.read(CONFIGURATION_FILENAME)
configuration = YAML.load(configuration_text)
username =... |
Fabricator(:user, :class_name => "User") do
password { "foo" }
first_name { "Beverly" }
last_name { "BOOM" }
admin { false }
email { "foo@foo.com" }
salt { "asdasdastr4325234324sdfds" }
crypted_password { Sorcery::CryptoProviders::BCrypt.encrypt("secret",
"asdasdastr4325234324sdfds")... |
require 'rails_helper'
require 'date'
RSpec.describe Job, type: :model do
it "validates presence of title" do
job = Job.new
job.title = ""
job.valid?
expect(job.errors[:title]).to include("can't be blank")
job.title = "Host-ess at our event"
job.valid?
expect(job.errors[:title]).to_not i... |
require 'generator_spec_helper'
# require_generator :data_mapper => :roles
require 'generators/data_mapper/roles/roles_generator'
# root_dir = Rails3::Assist::Directory.rails_root
# root_dir = File.join(Rails.application.config.root_dir, 'rails')
root_dir = Rails.root
describe 'role strategy generator: admin_flag' d... |
require 'perpetuity/reference'
module Perpetuity
describe Reference do
let(:reference) { Reference.new Object, 1 }
let(:object) { double('Object', class: Object) }
subject { reference }
before { object.instance_variable_set :@id, 1 }
it "stores the object's class in the `klass` attribute" do
... |
class ChangeEasyExSynchs < ActiveRecord::Migration
def self.up
add_column :easy_external_synchronisations, :direction, :string, {:null => false, :default => 'in'}
change_column :easy_external_synchronisations, :external_type, :string, {:null => true}
change_column :easy_external_synchronisations, :extern... |
require 'spec_helper'
describe Gossiper::EmailConfig do
before do
Gossiper.configure do |config|
config.default_from = 'from@email.com'
config.default_reply_to = 'replyto@email.com'
config.default_cc = ['cc@email.com']
config.default_bcc = ['bcc@email.com']
end
end
... |
require 'vanagon/component/source'
require 'vanagon/logger'
class Vanagon
class Component
class Source
# This class has been extracted from Vanagon::Component::Source for the
# sake of isolation and in service of its pending removal. Rewrite rules
# should be considered deprecated. The removal ... |
require 'spec_helper'
module Urkel
describe Connection do
subject { Connection.new(configuration) }
describe "#publish" do
let(:hostname) { Socket.gethostname }
let(:error_hash) do
{
"error"=>
{
"message" => error.message,
"hostname" => h... |
class User < ApplicationRecord
has_many :votes, dependent: :destroy
has_many :voted_answers, through: :votes, source: :answer
has_many :likes, dependent: :destroy
#has_many first arugment dose not have to be another table name, it can be name of you chosing, but when doing so you must sepcify details of the as... |
FactoryBot.define do
factory :user do
nickname { Faker::Internet.username(specifier: 1..40) }
email { Faker::Internet.free_email }
password { Faker::Internet.password(min_length: 6, mix_case: true) }
password_confirmation { password }
family_na... |
require "spec_helper"
describe Action do
before do
Game.current = Game.forge create(:user)
end
let(:game) { Game.current }
describe "process_outcomes" do
it "queues events" do
Action.new(:outcome => "queue_event:game_start_2").process_outcomes
game.events.map(&:event_code).should == ['ga... |
# Generated by jeweler
# DO NOT EDIT THIS FILE
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{integrity-nabaztag}
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_ruby... |
class ManageVersionFields < ActiveRecord::Migration
def change
remove_column :versions, :author
add_column :versions, :publication_date, :datetime
end
end
|
require('minitest/autorun')
require('minitest/reporters')
require_relative('../drink')
require_relative('../pub')
require_relative('../customer')
require_relative('../food.rb')
Minitest::Reporters.use!
Minitest::Reporters::SpecReporter.new
class TestDrink < Minitest::Test
def setup()
@drink1 = Drink.new("Tenne... |
require_relative "cards.rb"
require_relative "deck.rb"
require_relative "hand.rb"
require_relative "player.rb"
class Poker
def initialize(num_players = 4)
@players = []
base_purse = 100 # can change
@ante = 1 # can change
@deck = Deck.new
num_players.times do |i|
@players << Player.ne... |
class AddDefaultToStatus < ActiveRecord::Migration[5.0]
def change
change_column :reversed_gifs, :status, :string, :default => "started"
end
end
|
require "rails_helper"
describe CatalogsController do
let(:catalog) { create(:catalog) }
let(:user) { catalog.user }
describe "GET new" do
context "as a logged in user" do
it "renders the new catalog form" do
sign_in user
get :new
expect(response).to render_template(:new)
... |
require 'rack/response'
require 'rack/utils'
module Rack::Less
# Given some generated css, mimicks a Rack::Response
# => call to_rack to build standard rack response parameters
class Response
include Rack::Less::Options
include Rack::Response::Helpers
# Rack response tuple accessors.
attr_acces... |
class MembersController < ApplicationController
def show
@member = Member.find(params[:id])
@projects = Project.find_all_by_member_id(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @member }
end
end
end |
module ApplicationHelper
include CustomUrlHelper
def user_state_label(user)
cls = "label label-user-#{user.state_name}"
content_tag(:span, user.human_state_name, { class: cls })
end
def course_descriptions_body
page = Page.find_by_slug("course_descriptions")
page.present? ? page.body : nil
end... |
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string(255)
# first_name :string(255)
# last_name :string(255)
# mother_first_name :string(255)
# mother_last_name :string(255)
# mother_email :string(255)
# mothe... |
class Monster
attr_reader :name, :actions
#initialize the variables
def initialize
@name = name
@actions = {
screams: 0,
scares: 0,
chases: 0,
hides: 0
}
end
#introduction and request a name for the monster
def say
print "What do you want to call your monster? "
@name = gets.chomp
print ... |
#this example demonstrates the concept of modules in ruby
=begin
#1. module in ruby is defined with keyword module followed by module name
module Module_name
body of module
end
#2. module name always start's with Capital letter
#3. we can define functions, classes within modules
function is defined within modu... |
class CreateListWords < ActiveRecord::Migration[5.1]
def change
create_table :list_words do |t|
t.integer :list_id, null: false
t.integer :word_id, null: false
t.timestamps
end
add_index :list_words, [:list_id, :word_id], unique: true
end
end
|
json.array!(@items) do |item|
json.extract! item, :id, :price, :name, :image, :item_number, :cart_id, :description
json.url item_url(item, format: :json)
end
|
require 'rails_helper'
# As a user,
# When I visit the mechanics index page
# I see a header saying “All Mechanics”
# And I see a list of all mechanic’s names and their years of experience
# And I see the average years of experience across all mechanics
describe 'Mechanics Index' do
it 'has a list of all mechanics... |
require 'rails_helper'
describe 'User can sign in', "
In order to use canmusiccan
As an unauthenticated user
I'd like to be able to sign in
" do
let(:user) { create(:user) }
before { visit new_user_session_path }
it 'Registered user tries to sign in' do
I18n.default_locale
fill_in 'Email', with: use... |
require 'test_helper'
class CreatureActionsControllerTest < ActionDispatch::IntegrationTest
setup do
login_as users(:test_admin)
@creature_action = creature_actions(:talon)
end
test "should get index" do
get creature_actions_url
assert_response :success
end
test "should get new" do
get ... |
class BusesController < ApplicationController
before_filter :authorize
def index
@buses = initialize_grid(Bus)
respond_to do |format|
format.html
format.csv { send_data Bus.all.to_csv }
end
end
def show
@bus = Bus.find(params[:id])
end
def create
begin
Bus.import(params[:file])
... |
class Order < ApplicationRecord
# belongs_to :user
belongs_to :status
has_many :order_details
has_many :products, through: :order_details
end
|
class TweetsController < ApplicationController
before_action :find_tweet, only: [:show, :retweet]
def index
@tweet = Tweet.new
@tweets = Tweet.includes(:user).order(updated_at: :desc)
end
def create
@tweet = current_user.tweets.new(tweet_params)
unless @tweet.save
@error = @tweet.errors... |
class CartLineItem < ApplicationRecord
belongs_to :product
belongs_to :user
validates_presence_of :product_id, :user_id, :quantity
def save_or_update()
line_item = CartLineItem.find_by(user_id: self.user_id, product_id: self.product_id)
if line_item.nil?
self.save
else
line_item.update_attributes(quan... |
class PlaylistsController < ApplicationController
def create
@list = Playlist.create list_params
redirect_to '/songs'
end
private
def list_params
params.require(:list).permit(:song_id).merge(user: current_user)
end
end
|
class GymdaysController < ApplicationController
before_action :set_gymday, only: [:show, :edit, :update, :destroy]
# GET /gymdays
# GET /gymdays.json
def index
@gymdays = Gymday.all
end
# GET /gymdays/1
# GET /gymdays/1.json
def show
unless @today = Gymday.find_by(gym_date: params[:id])
... |
# Copyright::
# License::
# Description::
# Usage::
class DataChunk < ActiveRecord::Base
belongs_to :user
belongs_to :deployment
belongs_to :storage
include ModelMixins::PatternMixin
include ModelMixins::DataLinkMixin
# storage_id should always be present but deployment.deep_clone fails so we'll enforc... |
class Createcard < ActiveRecord::Migration
def change
create_table :cards do |t|
t.string :cardname
t.text :cardtype
t.text :requirements
t.integer :user_id
end
end
end
|
# The irbrc file for Sebastian Delmont <sd@notso.net>
#
# Most of the code here came from http://wiki.rubygarden.org/Ruby/page/show/Irb/TipsAndTricks
#
unless self.class.const_defined? "IRB_RC_HAS_LOADED"
begin # ANSI codes
ANSI_BLACK = "\033[0;30m"
ANSI_GRAY = "\033[1;30m"
ANSI_LGRAY = "\033[0;... |
class BlogsController < ApplicationController
def index
@blog = Blog.new
end
#新規作成処理
def create
@blog = Blog.new(blog_params)
if @blog.save
#成功の場合
#一覧画面へリダイレクト
redirect_to blogs_path, notice:'新規のつぶやきが完了しました'
else
#失敗の場合
#トップ画面を再描画
render confirm_blogs_pat... |
class AddStoreLocationIdToGuitars < ActiveRecord::Migration
def change
add_column :guitars, :store_location_id, :integer
end
end
|
require_relative '../../lib/cpu'
RSpec.describe CPU do
describe '.run' do
let(:cpu) { CPU.new }
describe 'LDA' do
it 'loads 42 into a A register' do
cpu.run(['LDA #42 ; comment'])
expect(cpu.a).to eq 42
end
it 'loads into a register from a memory address' do
cpu = ... |
class Tenant < ApplicationRecord
multi_tenant :tenant
validates :name, presence: true, uniqueness: { case_sensitive: false }, length: { maximum: 50 }
has_many :users
has_many :roles
has_many :permissions
has_many :role_permissions
end
|
# -*- coding: utf-8 -*-
require '../../code/unbuffered-stdin'
### Regex for hyphenated word
hyphenation_re =
%r{ ([A-ZÄÖÜ]?[a-zäöüß]+)-
\s* </p> \s* (?:<p> \s* </p> \s*)?
(<!--\ page\ [0-9]+\ -->)
\s* <p> \s*
([a-zäöü]+)
}x
### Regex for broken-up sentence
broken_sentence_re =
%r{ ([A... |
class Translation < Dry::Struct
transform_keys(&:to_sym)
attribute :project, Types::String
attribute :lang, Types::String.default('en'.freeze)
attribute :namespace, Types::String.default('translations'.freeze)
attribute :key, Types::String
attribute :hint, Types::String
attribute :value, Types::String.op... |
# frozen_string_literal: true
require 'apartment/model'
class UserWithTenantModel < ApplicationRecord
include Apartment::Model
self.table_name = 'users'
# Dummy models
end
|
class AddressBook
attr_reader :entries
def initialize
@entries = []
end
end
|
module SetForEndOfMonth
def set_for_end_of_month
# Defaults to current month if it's the last week of the month.
@show_current_month = ((Date.current.end_of_month - Date.current).to_i <= 7)
Sentry.configure_scope do |scope|
user = @current_admin || @current_user
scope.set_user(id: user.id)
... |
class AddLangToCmsTags < ActiveRecord::Migration
def change
remove_index :cms_tags, :name
add_column :cms_tags, :lang, :string, null:false, default: 'en'
add_index :cms_tags, :lang
add_index :cms_tags, [:lang, :name], unique: true
end
end
|
class CreateOrders < ActiveRecord::Migration[5.0]
def change
create_table :orders do |t|
t.integer :member_id, null: false
t.integer :shipping, null: false,default: "800"
t.integer :purchase_price, null: false
t.integer :payment_method, null: false, default: "0"
t.string :address_na... |
class Message < ApplicationRecord
belongs_to :conversation
belongs_to :user
validates :body, :conversation_id, :user_id, presence: true
scope :unread, ->(current_user) { where('user_id != ? AND read = ?', current_user.id, false) }
def self.read(current_user)
unread(current_user).update_all(read: true)
... |
require "spec_helper"
describe StoriesController do
describe "routing" do
specify {expect(get: '/').to route_to(controller:'stories', action:'index')}
specify {expect(get: '/stories').to route_to(controller:'stories', action:'index')}
specify {expect(get: '/stories/1').to route_to(controller:'stories', a... |
module RSpec
module Mocks
RSpec.describe ".allow_message" do
let(:subject) { Object.new }
it "sets up basic message allowance" do
expect {
::RSpec::Mocks.allow_message(subject, :basic)
}.to change {
subject.respond_to?(:basic)
}.to(true)
expect(sub... |
class AddPreferedCapoToUserSongPreference < ActiveRecord::Migration
def change
add_column :user_song_preferences, :prefered_capo, :integer
end
end
|
require 'rails_helper'
RSpec.describe Coat, type: :model do
before do
@coat = FactoryBot.build(:coat)
end
describe '新規投稿する' do
context '投稿できる場合' do
it '全て適切に入力すれば投稿できる' do
expect(@coat).to be_valid
end
it 'セレクター項目で、id1以外を選択すれば投稿できる' do
@coat.prefecture_id = 2
@co... |
require 'twilio-ruby'
require_relative '../../credentials'
class Notification
attr_accessor :to_number
def initialize(options = {})
self.to_number = options[:to_number]
account_sid = Credentials.credentials[:twilio_account_sid]
auth_token = Credentials.credentials[:twilio_account_token]
@client = ... |
class TpParkRepresenter < Representable::Decorator
include Representable::JSON
property :name
collection :attractions, class: AttractionRepresentation do
property :name
property :short_name
property :permalink
end
end |
#!/usr/bin/env ruby
require 'json'
require 'open-uri'
GITHUB_EMOJI_JSON = 'https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json'
src_json_path = ARGV[1] || GITHUB_EMOJI_JSON
open(src_json_path) do |file|
out = {}
src = JSON.load(file)
src.each do |entry|
next unless (emoji = entry['emoji']... |
class Events::PostPublished < Events::Event
belongs_to :subject, :class_name => 'ExternalFeedEntry', :foreign_key => 'subject_id'
belongs_to :object, :class_name => 'Organization', :foreign_key => 'object_id'
def initialize(*args)
super(*args)
self[:subject_type] = "ExternalFeedEntry"
self[:object_t... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get '/name_params' => 'params#name_method'
get '/number_guess' => 'params#number_guess_method'
end
|
# class to create a member object
class Member
attr_reader :full_name
def initialize(full_name)
@full_name = full_name
end
def introduce
puts "Hi, my name is #{@full_name}"
end
end
# class to create student object
class Student < Member
attr_reader :reason
def initialize(full_name, reason)
... |
Myflix::Application.routes.draw do
get 'ui(/:action)', controller: 'ui'
get 'home', controller: 'videos', action: 'index'
root to: 'pages#front'
get 'login', to: 'sessions#new'
get 'sign_out', to: 'sessions#destroy'
get 'register', to: 'users#new'
get 'my_queue', to: 'queue_items#index'
get 'forgot_pa... |
class AddIndexCustomer < ActiveRecord::Migration
def up
add_column :customer_cards, :pending_id,:integer
add_index :customer_cards, :pending_id
end
def down
remove_index :customer_cards, :pending_id
remove_column :customer_cards, :pending_id
end
end
|
require 'sass/importers/base'
require 'pathname'
module Sprockets
module Sass
class Importer < ::Sass::Importers::Base
GLOB = /\*|\[.+\]/
# @see Sass::Importers::Base#find_relative
def find_relative(path, base_path, options)
if path =~ GLOB
engine_from_glob(path, base_path, o... |
module MonthlyDistrictReport
class Exporter
attr_reader :facility_data, :block_data, :district_data
def initialize(facility_data:, block_data:, district_data:)
@facility_data = facility_data
@block_data = block_data
@district_data = district_data
end
def export
facility_csv =... |
class CreateOrders < ActiveRecord::Migration[5.0]
def change
create_table :orders, id: :uuid do |t|
t.string :email
t.string :browser_ip
t.boolean :buyer_accepts_marketing, default: false, null: false
t.integer :cancel_reason
t.datetime :cancelled_at
t... |
#https://github.com/CzarcasticJack/lab2/blob/master/Lab2.rb
# Part1: Hello World
class HelloWorldClass
def initialize(name)
@name = name.capitalize
end
def sayHi
puts "Hello #{@name}!"
end
end
hello = HelloWorldClass.new("{Josh}")
hello.sayHi
# Part 2
def palindrome?(string)
string = string.downcas... |
class Badge < ActiveRecord::Base
belongs_to :school, :foreign_key => :cod
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.