text stringlengths 10 2.61M |
|---|
class AddClassPeriodsToSchool < ActiveRecord::Migration[6.0]
def change
add_reference :schools, :class_period, index: true
end
end
|
class PicturesController < ApplicationController
def create
@user = current_user
@user.picture.attach(params[:avatar])
end
end
|
# frozen_string_literal: true
require_relative './board'
describe Board do
describe '3x3' do
before do
Game.width = 3
Game.height = 3
end
let(:target_board) { described_class.target_board }
let(:unsolvable_board) { described_class.new([2, 1, 3, 4, 5, 6, 7, 8, 0]) }
let(:board_one) {... |
# frozen_string_literal: true
# rubocop:todo all
# Copyright (C) 2019-2020 MongoDB 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
#
# U... |
class CreateStocks < ActiveRecord::Migration[5.0]
def change
create_table :stocks do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "symbol"
t.decimal "last"
t.decimal "percentChange"
t.decimal "ivr"
t.decimal "iv"
... |
class AddInactiveToProjectMedia < ActiveRecord::Migration
def change
add_column :project_medias, :inactive, :boolean, default: false
add_index :project_medias, :inactive
end
end
|
class Pais < ActiveRecord::Base
has_many :provincias
end
|
class CreateInvitations < ActiveRecord::Migration
def change
create_table "invitations" do |t|
t.integer :user_id
t.integer :group_id
t.string :inviter_username
t.string :group_name
t.datetime :created_at, null: false
t.datetime :updated_at, null: false
end
end
end
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Brcobranca::Remessa::Cnab400::Sicoob do
let(:pagamento) do
Brcobranca::Remessa::Pagamento.new(valor: 199.9,
data_vencimento: Date.current,
nosso_numero: 123,
... |
require 'net/http'
module VraptorScaffold
class HttpRequest
def self.open_session url
return http.start url
end
protected
def self.http
return Net::HTTP unless ENV['http_proxy']
uri = URI.parse(ENV['http_proxy'])
proxy_user, proxy_pass = uri.userinfo.split(/:/) if uri.user... |
class Word < ApplicationRecord
belongs_to :language
belongs_to :text
has_many :translations
end
|
require "telemetry/helper"
module Telemetry
class InvalidAnnotationException < Exception; end
class Annotation
include Helpers::TimeMaker
include Helpers::Jsonifier
attr_reader :params, :log_time, :time_to_process
def initialize(params, time_to_process=nil)
raise InvalidAnnotationExceptio... |
class AddMinimumStayToBooking < ActiveRecord::Migration[5.0]
def change
add_column :bookings, :minimum_stay, :integer
end
end
|
module ListMore
class ShareList < UseCase
attr_reader :params
def run params
shared_list = ListMore.shared_lists_repo.save params
return false unless shared_list
success shared_list: shared_list
end
end
end
|
class CreateModerators < ActiveRecord::Migration[5.0]
def up
create_table :moderators do |t|
t.string :name
t.string :channel_id
t.timestamps
end
end
def down
drop_table :moderators
end
end
|
# encoding: UTF-8
class Interest < ActiveRecord::Base
attr_accessible :title, :kid_id
validates :title, :uniqueness => {:message => 'عنوان تکراری است'}
validates :title, :presence => {:message => 'عنوان را بنویسید'}
belongs_to :kid
end
|
require File.dirname(__FILE__) + '/../test_helper'
class EventTest < ActiveSupport::TestCase
context 'working with active record callbacks' do
def setup
event_instance = Factory :article_instance
@event = Event.create :article_instance => event_instance
@user = Factory :user
... |
require "minitest/autorun"
require_relative '../../lib/action/reverse.rb'
require_relative './robot_maker.rb'
class TestLeft < Minitest::Test
def test_act_reverse
reverse = Game::Reverse.new
robot = RobotMaker::create(0, 0, "NORTH")
x, y, direction = reverse.act(robot, "REVERSE")
assert_equal 0, x
... |
namespace :twitter do
desc "Clears the user and tweet tables"
task :clear => :environment do
User.destroy_all
Tweet.destroy_all
end
desc "Creates fake Twitter posts and users"
task :posts, [:user_count] => :environment do |t, args|
FactoryGirl.create_list :user_with_tweets, args[:user_count].to_i... |
Rails.application.routes.draw do
resources :outboxes
resources :inboxes
resources :messages do
collection do
get :picture
get :comment
end
end
get '/user_tops', to: 'user_tops#index'
end
|
class Mechanic < ApplicationRecord
has_many :rides
validates_presence_of :name
validates_presence_of :years_experience
def self.average_experience
total = Mechanic.all.sum do |mechanic|
mechanic.years_experience.to_f
end
(total/(Mechanic.all.count)).round(2)
end
def working_on
require "... |
class CreateTransactions < ActiveRecord::Migration[5.2]
def change
create_table :transactions do |t|
t.string :ref_no
t.integer :amount, default: 0
t.string :transaction_for
t.integer :user_id
t.integer :duration, default: 1
t.string :status, default: "PENDING"
t.timesta... |
class Favorite < ActiveRecord::Base
belongs_to :user
belongs_to :favoritible, polymorphic: :true
end
|
module UsersHelper
def settings_box(icon_class:, title:, url:, description:)
render partial: 'users/settings_box',
locals: { icon_class: icon_class, title: title,
url: url, description: description }
end
end
|
class Purchase < ApplicationRecord
belongs_to :product
belongs_to :user
has_one :buyer
end
|
class House < ApplicationRecord
has_many :windows do
end
has_many :broken_windows, class_name: 'Window'
end
|
module WickedPdfHelper
def wicked_pdf_image_tag_if(condition, url)
if condition
wicked_pdf_image_tag url
else
image_tag url
end
end
end
|
class FollowPostsController < ApplicationController
before_action :set_follow_post, only: [:show, :edit, :update, :destroy]
# GET /follow_posts
# GET /follow_posts.json
def index
@follow_posts = FollowPost.where(user: current_user)
end
# GET /follow_posts/1
# GET /follow_posts/1.json
de... |
# encoding: utf-8
class RecipeRanking < ActiveRecord::Base
paginates_per 10
def self.topics
Recipe.where( id: page(1).per(2).pluck(:recipe_id) ).includes( :user => :user_profile )
end
# create ranking
def self.aggrigate
# ranking sorted by only page view_count
ranking = Recipe.order("view_count... |
require 'spec_helper'
module SadPanda
describe StatusMessage do
let(:status_message) {SadPanda::StatusMessage.new "a message"}
let(:emotions) {status_message.get_term_emotions}
let(:polarities) {status_message.get_term_polarities}
let(:term_frequencies) {status_message.build_term_frequencies}
describe "wh... |
class CreateRecruits < ActiveRecord::Migration[5.2]
def change
create_table :recruits do |t|
t.integer :company_id
t.string :title
t.text :do
t.integer :occupation
t.string :job_description
t.integer :employment_status
t.string :field
t.timestamps
end
end
end... |
require_relative '../../../lib/databender/runner'
module Databender
module Cli
class Main < Thor
include Thor::Actions
source_root File.expand_path('../../templates', __FILE__)
option :db_name, required: true, desc: 'Name of the database'
option :driver, required: false, desc: 'Driver:... |
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2023, by Samuel Williams.
# Copyright, 2022, by Anton Sozontov.
require_relative 'event/progress'
require_relative 'clock'
module Console
class Progress
def self.now
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
def ... |
class AddClosingToTracker2 < ActiveRecord::Migration
def self.up
add_column :trackers, :easy_do_not_allow_close_if_no_attachments, :boolean, {:null => true}
end
def self.down
remove_column :trackers, :easy_do_not_allow_close_if_no_attachments
end
end |
module LevelEditor
class LineManager
attr_reader :image_interroger, :lines, :lines_array
COLOR = "black"
def initialize(image_interroger)
@image_interroger = image_interroger
@lines = Hash.new{|hash, key| hash[key] = []}
@lines_array = Hash.new{|hash, key| hash[key] = []}
end
... |
class AddDataSetTreeToProjects < ActiveRecord::Migration
def change
add_column :projects, :data_set_tree, :text
end
end
|
# Ruby Crash Course
# if_statements.rb
# Created by Mauro José Pappaterra on 06 April 2017.
############################################ IF STATEMENTS
if 1 < 2 # if true
puts "Your code goes here" # this will be executed
end
if (0 > 1000) # parenthesis are optional
puts "This will never be executed"
end
if (fal... |
require 'net/http'
require 'json'
class Slack
def initialize(token)
@token = token
end
def publish_view(user_id, view)
Net::HTTP.post URI('https://slack.com/api/views.publish'), { user_id: user_id, view: view }.to_json,
'Content-Type' => 'application/json', 'Authorization' => "Bearer ... |
Gem::Specification.new do |s|
s.name = 'loggz'
s.version = '0.2'
s.date = '2013-10-30'
s.summary = "Library for log parsing"
s.description = "Scans for gz files, reads them and sends it to redis"
s.authors = ["Colby Shores"]
s.email = 'colby.shores@voicemediagroup.com'
s.... |
class Application < ApplicationRecord
has_many :application_pets
has_many :pets, through: :application_pets
has_many :shelters, through: :pets
def form_incomplete?
self.name.blank? || self.street_address.blank? || self.city.blank? ||
self.state.blank? || self.zip_code.blank?
end
def count_pets
... |
# Implementation of a singly linked list in Ruby
class Node
attr_accessor :value, :next
def initialize(value)
@value = value
@next = nil
end
end
class SinglyLinkedList
attr_accessor :head, :next
def initialize(head)
@head = head
@next = nil # if the list itself is nested
end
def inse... |
module Erp
class UserGroup < ApplicationRecord
validates :name, presence: true
has_many :users
belongs_to :creator, class_name: "Erp::User"
# Filters
def self.filter(query, params)
params = params.to_unsafe_hash
and_conds = []
#keywords
if params["keywords"].present?
... |
require 'csv'
class CSVDiff
# Defines functionality for exporting a Diff report in TEXT format. This is
# a CSV format where only fields with differences have values.
module Text
private
# Generare a diff report in TEXT format.
def text_output(output)
path = "#{File.... |
require 'chronic/handlers/time_zone'
module Chronic
class TimeZoneObject < HandlerObject
include TimeZoneStructure
def initialize(tokens, token_index, definitions, local_date, options)
super
match(tokens, @index, definitions)
end
def normalize!
return if @normalized
@offset ... |
class E6b::Reports::HtmlReport < E6b::Reports::Report
def initialize(**args)
super args
end
def make_report
@io = StringIO.new
make_html_head
make_headings
make_rows
make_html_closing_tags
@io.string
end
def make_html_head
@io.puts "<!DOCTYPE html>"
@io.puts "<html>"
@io.puts "... |
class Piece
attr_accessor :current_pos
attr_reader :color, :board, :symbol
ORTHO = [[1, 0], [-1, 0], [0, -1], [0, 1]]
DIA = [[1, 1], [-1, 1], [1, -1], [-1,-1]]
def initialize(current_pos, color, board)
@current_pos = current_pos
@color = color
@board = board
end
end |
class RecordqnyttsController < ApplicationController
before_action :set_recordqnytt, only: [:show, :edit, :update, :destroy]
# GET /recordqnytts
# GET /recordqnytts.json
def index
@recordqnytts = Recordqnytt.all
end
# GET /recordqnytts/1
# GET /recordqnytts/1.json
def show
end
# GET /recordqn... |
# -*- encoding : utf-8 -*-
class Venue < ActiveRecord::Base
include UUID, Trashable
attr_accessor :visited_count
attr_accessor :played_count
belongs_to :city
has_many :courses
has_many :matches
reverse_geocoded_by :latitude, :longitude
scope :alphabetic, -> { order('CONVERT(venues.name USING GBK) asc') ... |
require_relative 'piece'
require_relative 'queen'
require_relative 'stepping_piece'
class King < Piece
include SteppingPiece
def self.directions
Queen.directions
end
def symbol
"\u2654"
end
end |
# frozen_string_literal: true
require "#{Rails.root}/lib/importers/category_importer"
#= Controller for Article Finder tool
class ArticleFinderController < ApplicationController
DEFAULT_MAX_WP10_SCORE = 100
MAX_DEPTH = 2
def index
@depth ||= 0
@min_views ||= 0
@max_wp10 ||= DEFAULT_MAX_WP10_SCORE
... |
namespace :check do
namespace :migrate do
task relate_smooch_user_to_team: :environment do
started = Time.now.to_i
Team.find_each do |team|
team.projects.find_in_batches(:batch_size => 2500) do |ps|
print '.'
ids = ps.map(&:id)
Annotation.where(
annota... |
# frozen_string_literal: true
require 'rails_helper'
require_relative '../../../../lib/areas/queries/contain'
RSpec.describe Areas::Queries::Contain do
subject { described_class.new.call(areas, point) }
# See https://gist.github.com/scoiatael/bf6f335ea22c8a4cddf35b0f1963f439 for points and areas
context 'when ... |
class Favorite < ApplicationRecord
after_create :send_favorite
belongs_to :recipe
belongs_to :user
validates_uniqueness_of :user_id, scope: :recipe_id
private
def send_favorite
UserFavoritesMailer.saved_recipe(self).deliver
end
end
|
Achievement.delete_all
SALES_2017_BY_MONTH = {
1 => 7.13,
2 => 7.52,
3 => 6.89,
4 => 8.0,
5 => 7.92,
6 => 7.44,
7 => 8.39,
8 => 7.6,
9 => 6.89,
10 => 7.68,
11 => 8.0,
12 => 16.55
}
SALES_JUNE = Settings::DEMO_DEPARTMENTS['Accesorios Mujer']['sales_june_2017']
SALES_RATE_JUNE = Settings::DEMO_D... |
require 'test_helper'
class SurveysControllerTest < ActionController::TestCase
include Devise::Test::ControllerHelpers
before do
@admin = create(:user, :admin)
@presentation = create(:presentation)
sign_in @admin
end
describe '#new' do
before do
get(:new, params: { presentation_id: @pr... |
require 'spec_helper'
require 'autotest/cucumber_mixin'
describe "cucumber_mixin" do
before :all do
@super_test_class = Class.new do
ALL_HOOKS = [:red]
def get_to_green
end
end
@test_mixin_class = Class.new(@super_test_class) do
attr_accessor :results
include Autotest::Cucum... |
# @author Dean Silfen
module TextBelt
class TextUtils
class << self
# Return the correct URI for the correct country code
#
# @param country [String] ISO 3166 Country code for destination country
#
# @return [URI] URI object holding the uri to match the country code
def uri_fo... |
require "rails_helper"
describe "Call History Query API", :graphql do
describe "callHistory" do
let(:query) do
<<~'GRAPHQL'
query($phoneNumber: PhoneNumber!) {
callHistory(phoneNumber: $phoneNumber) {
edges {
node {
id
}
... |
module API::V1::Admin
class ProductsController < API::V1::ApplicationController
before_action :authenticate_user
before_action :set_product, only: [:show, :update, :destroy]
def index
json_response(Product.all)
end
def create
@product = Product.create!(product_params)
render js... |
class RegistrationsController < Devise::RegistrationsController
# def destroy
# redirect_to root_path
# end
# def update
# account_update_params = devise_parameter_sanitizer.sanitize(:account_update)
# if account_update_params[:password].blank?
# account_update_params.delete("password")
# ... |
class AddFormatFormIdToQuestion < ActiveRecord::Migration
def change
add_column :questions, :format_form_id, :integer
end
end
|
#!/usr/bin/env ruby
#
# This code processes the given txt.final file at the given path (ARGV[0]) of the
# given name (ARGV[1]). i.e. The file is at ARGV[0]/ARGV[1].txt.final
#
# to produce four files:
# - .txt (hyphens removed)
# - .tokenized.txt (tokenized)
# - .postagged.txt (POS tagging)
# - .stemmed.txt (stemming)
... |
# encoding: utf-8
class Batch::Base
class << self
def type_selecter(title)
case
when title =~ /(アイスクリーム|グラス|ソルベ)/
type_name = "アイスクリーム"
when title =~ /タルトグラッセ/
type_name = "クッキーアイス"
when title =~ /(トリュフ|ゴールド|グランプラス|ラッピング|ボワットゥ|クリスタルクール)/
type_name = "トリュフ"
whe... |
class Item < ApplicationRecord
belongs_to :user
has_one_attached :image
has_one :order
has_many :comments, dependent: :destroy
extend ActiveHash::Associations::ActiveRecordExtensions
belongs_to :category
belongs_to :status
belongs_to :delivery_fee
belongs_to :delivery_area
belongs_to :delivery_date... |
# frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe Mongo::Cursor do
let(:authorized_collection) do
authorized_client['cursor_spec_collection']
end
before do
authorized_collection.drop
end
describe '#initialize' do
let(:server) do
view.send(:server_selector).s... |
require 'fileutils'
namespace :app do
desc "Restart application, when deployed with Phusion Passenger"
task :restart do
FileUtils.touch "#{RAILS_ROOT}/tmp/restart.txt"
end
end
|
require_relative 'command'
class Remind < Command
def self.check_reminders(client)
client.db.execute('select id,jid,time,:ext,room from reminders where time <= ?', [DateTime.now.to_s]) do |row|
if row[4]
client.send(row[4], "Hey, #{row[1]}, #{row[3]}")
else
... |
def a_global_method(a, b)
a + b
end
RSpec.describe "methods in ruby" do
it "is possible to call a global method" do
expect( a_global_method(5, 9) ).to eq(14)
end
it "is possible to call a method without parens" do
expect( a_global_method 4, 8 ).to eq(12)
end
it "is sometimes ambiguous to leave ou... |
json.array!(@this_or_thats) do |this_or_that|
json.extract! this_or_that, :id, :image1, :image2, :description, :comment, :is_private, :user_id, :pants_brand, :shirt_brand, :shoes_brand, :hat_brand, :jacket_brand
json.url this_or_that_url(this_or_that, format: :json)
end
|
class RolesController < ApplicationController
before_filter :check_administrator_role
before_filter :login_required
def index
@all_roles = Role.all
@user = User.find(params[:user_id])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @all_roles }
end
end
def update
... |
#
# Change permissions
#
#
namespace :permission do
desc "Setup permissions"
task :authorize do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
execute :chmod, "-Rf 755 app/storage"
execute :chmod, "-R o+w app/storage"
execute :chmod, "775 #{release_path}/.en... |
class ProductVariant < ApplicationRecord
belongs_to :product
has_many :bags
end
|
require 'test_helper'
class Users::RegistrationsControllerTest < ActionDispatch::IntegrationTest
setup do
end
test "should create a user" do
assert_difference('User.count') do
post '/users', params: {
user: {
name: 'Test User',
email: 'test@example.com',
password... |
class HairusersController < ApplicationController
before_action :set_hairuser, only: [:show, :edit, :update, :destroy]
respond_to :json
# GET /hairusers
# GET /hairusers.json
def index
@hairusers = Hairuser.all.order(:userid, :timedate)
end
# GET /hairusers/1
# GET /hairusers/1.json
def show
... |
require 'rails_helper'
RSpec.describe TaskOrders, type: :model do
it { should validate_presence_of(:task_id) }
it { should validate_presence_of(:order_id) }
it { should validate_presence_of(:budget) }
it { should belong_to(:order) }
it { should belong_to(:task) }
it 'should fail if budget equals zero ' do
... |
require "menu"
describe Menu do
subject(:menu){ described_class.new }
let(:menu_r){ {
'hamburger' => 2,
'pasta' => 4,
'burrito' => 3,
'lasagna' => 5
} }
it "expect to print a menu with all the dishes and the prices" do
expect(menu.dishes).to eq(menu_r)
end
end
|
class User < ApplicationRecord
has_many :microposts
validates :name,length:{ maximum: 10 },presence:true
validates :email,presence:true
end
|
#!/usr/bin/ruby
# passing code blocks into method
# yield
def test_method
puts 'starting test method'
yield
puts 'ending test method'
end
test_method {puts 'say something'}
# yield with 1 param
def test_method
puts 'starting test method'
puts yield 5
puts 'ending test method'
end
test_method {|number| ... |
class CountdownsController < ApplicationController
def new
@countdown = Countdown.new
end
def create
@countdown = Countdown.new(countdown_params)
@countdown.save!
respond_to do |format|
format.html { redirect_to @countdown }
end
end
def show
@countdown = Countdown.find params[... |
# frozen_string_literal: true
require "spec_helper"
require 'fixtures/user'
require 'fixtures/post'
require 'fixtures/inline_schema'
require 'fixtures/policy_object_schema'
require "graphql/guard/testing"
RSpec.describe GraphQL::Guard do
context 'inline guard' do
context 'with a authorizable user' do
le... |
require File.join(File.dirname(__FILE__), 'http', 'loghttp')
require 'uri'
require 'CGI'
module RubyLogReveal
module Client
class HTTP
attr_reader :input_uri, :log_sender
def initialize(options={})
@input_uri = options[:input_url]
begin
@input_uri = URI.parse(@input_uri)
... |
class TerritoriesController < ApplicationController
# GET /territories
# GET /territories.xml
def index
@territories = Territory.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @territories }
end
end
# GET /territories/1
# GET /territories/1.xml... |
class AccountLimitUpdateService
TEN_MINUTES = 600
attr_reader :token, :limit
def initialize(token:, limit:)
@token = token
@limit = limit
end
def self.update(...)
new(...).update
end
def update
return unless update_allowed?
update_limit
end
private
def user
@user ||= U... |
class PairPlayer < Player
def self.find_or_create_by_users(user1, user2)
PairPlayer.find_or_create_by(username: concatenate_and_order_usernames(user1, user2))
end
def self.concatenate_and_order_usernames(username1, username2)
usernames = [username1, username2]
"#{usernames.min} #{usernames.max}"
e... |
class QuizzesController < ApplicationController
before_filter :authenticate_user!
# GET /quizzes
# GET /quizzes.xml
def index
@quizzes = Quiz.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @quizzes }
end
end
# GET /quizzes/1
# GET /quizzes... |
class ApplicationController < ActionController::Base
protect_from_forgery
protected
def authenticate
uid = ENV['USER_ID'] || USER_ID
pwd = ENV['PASSWORD'] || PASSWORD
authenticate_or_request_with_http_basic do |username, password|
username == uid && password == pwd
end
end
end
|
class AddColumnEspecificacao < ActiveRecord::Migration[5.0]
def change
add_column :servicos, :especificacao, :text
end
end
|
# frozen_string_literal: true
class PriceAgeGroupsController < ApplicationController
before_action :admin_required
before_action :set_price_age_group, only: %i[show edit update destroy]
def index
@price_age_groups = PriceAgeGroup.order(:from_age).to_a
end
def show
edit
end
def new
@price_a... |
module Hydramata
module Works
module ConfigurationMethods
def work_model_name
@work_model_name ||= default_work_model_name
end
def work_model_name=(string)
@work_model_name = String(string)
end
def default_work_model_name
'Work'
end
private :defa... |
#Schame
# t.string "name", :null => false
# t.integer "state_id"
class City < ActiveRecord::Base
# Associated models
belongs_to :state
has_many :orders
has_many :user_addresses
# Accessible attributes
attr_accessible :name, :state_id
# Associated validations
validates :name, :presence => true, :... |
class CreateInstallationPurchases < ActiveRecord::Migration
def change
create_table :installation_purchases do |t|
t.integer :installation_id
t.integer :input_by_id
t.integer :applicant_id
t.string :part_name
t.string :spec
t.decimal :qty, :precision => 6, :scale => 2
t.s... |
class Jzmq < Formula
desc "Java bindings for zeromq"
homepage "https://gitjub.com/zeromq/jzmq"
head "https://github.com/zeromq/jzmq.git", :revision => "d8d8b03a7f86f7738"
# needs older version of zmq, see https://github.com/zeromq/jzmq/issues/318
depends_on "zeromq22"
depends_on "pkg-config" => :build
d... |
require 'benchmark'
UPPER_BOUND = 1000000
def largest_pandigital
largest_pandigital = ""
9.upto(UPPER_BOUND) do |num|
next if num.to_s.chars.include? "0" # Pandigitals should only
# include ints in [1, 9].
# A number has repeated digits so we skip and check the next... |
class VoteOpinion < Vote
#-----------
# Includes
#-----------
#-----------
# Callbacks
#-----------
# Relationships
#-----------
belongs_to :poll_opinion,
foreign_key: 'poll_id',
class_name: 'PollOpinion',
optional: true,
touch: true
belongs_to :a... |
#!/usr/bin/env ruby
### Config: Amazon S3 credentials
s3bucket = "mys3bucket"
### Config: temporary directory
output_dir = "/path/to/dir"
### Config: select databases to backup
d = Hash.new
d["MySiteName"] = Hash.new
d["MySiteName"]["slug"] = "myslug"
d["MySiteName"]["host"] = "myhost"
d["MySiteName"]["name"] = "my... |
log "Installing maven version #{node['maven']['version']}" do
level :info
end
# NOTE: a package 'maven' is available too.
# Install maven - probably pretty old version
# On Ubuntu it installs version '3.0.5'
package 'maven' do
action :install
end
include_recipe 'maven'
log 'Finished configuring maven.' do
leve... |
class Film < ActiveRecord::Base
self.table_name = "film"
self.primary_key = "film_id"
has_and_belongs_to_many :actors, join_table: "film_actor"
has_and_belongs_to_many :categories, join_table: "film_category"
belongs_to :language
has_many :inventories
def self.search(search)
if search
where('... |
class Game < ApplicationRecord
has_many :races, dependent: :destroy
end
|
require 'fastlane/action'
require_relative '../helper/config'
require_relative '../helper/file_helper'
require_relative '../helper/app'
module Fastlane
module Actions
module SharedValues
AnalyzeIosIpaActionResultHash = :AnalyzeIosIpaActionResultHash
AnalyzeIosIpaActionResultJSON = :AnalyzeIosIpaActio... |
class Review < ApplicationRecord
belongs_to :story
belongs_to :user
validates :comment, length: { minimum: 10 }
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.