text stringlengths 10 2.61M |
|---|
class ProductCategory < ActiveHash::Base
self.data = [
{ id: 0, date: '--' },
{ id: 1, date: 'レディース' },
{ id: 2, date: 'メンズ' },
{ id: 3, date: 'ベビィ・キッズ' },
{ id: 4, date: 'インテリア・住まい・小物' },
{ id: 5, date: '本・音楽・ゲーム' },
{ id: 6, date: 'おもちゃ・ボビー・グッズ' },
{ id: 7, date: '家電・スマホ・カメラ' },
... |
# frozen_string_literal: true
require 'csv'
require 'pry'
namespace :sync_users do
# Check how many accounts needed to be fixed in the last month.
# Iterate through the users in the Sierra CSV.
# For each user, see if they exist in the MLN database.
# If they do, and if the MLN user was created within the l... |
require '../lib/reqs'
# 1
#Given any state, first print out the senators for that state (sorted by last name)
#then print out the representatives (also sorted by last name).
#Include the party affiliation next to the name.
STATE = 'MN'
senators = CongressMember.where({:state => STATE, :title => 'Sen'})
reps = Congr... |
class CreateRoleRankDetails < ActiveRecord::Migration[5.2]
def up
create_table :role_rank_details do |t|
t.integer "role_rank_id" #Role Rank ID
t.integer "role_id" #Role ID
t.integer "sort_order" #Ranking order of the roles
t.timestamps #audit
end
end
def down
drop_table :rol... |
Rails.application.routes.draw do
get 'shifts/index'
devise_for :users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :teams do
member do
post :add_member
get :remove_member
end
end
resources :shifts do
collection do
... |
module ContactsHelper
def initialize_contact(contact)
@contact = contact || current_account.contacts.build
@contact.emails.build if @contact.emails.empty?
@contact.websites.build if @contact.websites.empty?
@contact.phones.build if @contact.phones.empty?
@contact.addresses.build if ... |
require 'integration_helper'
require_relative 'classic_app.rb'
RSpec.describe 'Sinatra Classic app integration', type: :integration do
include Yaks::Sinatra::Test::ClassicApp::Helpers
::Yaks::Format.all.each do |format|
context "For #{format.format_name}" do
it "returns 200" do
make_req(format.m... |
require 'data_magic/standard_translation'
require 'faker'
module AddressBook
module Data
class Base < WatirModel
attr_accessor :id
end
class Defaults
include DataMagic::StandardTranslation
def self.translate(key)
return new.send(:characters, 10) if key == :password
n... |
class RemoveDefaultStatusFromParticipant < ActiveRecord::Migration
def change
change_column_default :participants, :status, nil
end
end
|
=begin
3. Build-a-Quiz
1.) Build a quiz program that gets a few inputs from the user including:
1-number of questions
2-questions
3-answers
2.) Then clear the screen and begin the quiz. Keep score!
--------------------------------------------------------------------------------
def qui... |
describe RunPlaybookService do
let(:release_order) { ReleaseOrder.first }
before(:each) do
allow(release_order.release).to receive(:playbook_dir).and_return './spec/services/temp_files'
allow(IO).to receive(:popen)
release_order.approved!
end
it 'should set release order status to deployed after p... |
require_relative './client_generator.rb'
module Rockauth
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path('../../templates', __FILE__)
desc 'Installs Rockauth'
def copy_initializer
template 'rockauth_full_initializer.rb', 'config/initializers/rockauth.rb'
end
... |
require "attr_immutable/version"
module AttrImmutable
def self.included (base)
base.extend(ClassMethods)
end
module ClassMethods
def attr_immutable (*args)
args.each do |arg|
setter = "#{arg}=".to_sym
define_method(arg) do
self.attr_immutable(arg)
self.s... |
class ChangeTypeFieldCodeColor < ActiveRecord::Migration[6.1]
def change
change_column :colors, :code_color, :string
end
end
|
class AnnoncesController < ApplicationController
before_action :set_annonce, only: [:show, :edit, :update, :destroy]
# GET /annonces
# GET /annonces.json
def index
if current_user.email == "nohchi.eu@gmail.com"
@annonces = Annonce.all
else
redirect_to root_path, notice: 'Vam nelzya na etu stra... |
class AddUserIdtoSpaces < ActiveRecord::Migration[5.0]
def change
remove_reference :spaces, :host, index: true
add_reference :spaces, :user, index: true
end
end
|
class Admin::GroupsController < ApplicationController
layout "admin"
def index
@groups = Group.all
respond_to do |format|
format.html # index.html.erb
format.js
end
end
def show
@group = Group.find(params[:id])
respond_to do |format|
format.html # show.html.erb
forma... |
require "sinatra"
require "json"
require_relative "model/enviador_de_mails"
configure do
set :bind, '0.0.0.0'
end
post '/' do
begin
entrada = request.body.read
if(entrada == "")
raise ExcepcionArchivoNoEncontrado
end
hash_entrada = JSON.parse(entrada)
sender = Enviador.new
... |
describe "NdcTree::Node#output" do
it "returns true when output format is not String" do
tree = NdcTree << %w{ 913.6 400 713 }
tree.print_image(:png=>"test.png").should == true
end
it "returns binary data when output format is String" do
tree = NdcTree << %w{ 913.6 400 713 }
tree.print_image(:png... |
class Garage < ApplicationRecord
has_many :vehicles, dependent: :destroy
validates :name, presence: true,
length: { minimum: 3 }
end
|
class MemberAbility < BaseAbility
def initialize(user)
can :manage, User, id: user.id
cannot :show, :admin_controllers
cannot :show, :admin_dashboard
can :show, :member_dashboard
can :manage, List, user_id: user.id
can :manage, Santa
end
end
|
class RemoveContentAttributeFromBundleModel < ActiveRecord::Migration
def self.up
remove_column "bundles", :content
end
def self.down
add_column "bundles", :content, :text, :limit => 16777215 # 16MB
end
end
|
class DownloadsController < ApplicationController
require 'ntpumis_logger'
before_action :authenticate_user!, only: [:new, :index, :show, :edit, :create, :update, :destroy]
before_action :find_download, only:[:edit, :update, :destroy]
DOWNLOAD_TYPE={
:enrollment => "招生簡介",
:newspaper => "資管所通訊",
:e... |
$: << File.join(File.dirname(__FILE__), 'lib')
require 'router'
CONFIG_FILE = File.join('config', 'config.rb')
CONFIG = eval(File.read(CONFIG_FILE), binding, CONFIG_FILE, 1) rescue \
raise(::ArgumentError, "Failed to read #{CONFIG_FILE}: #{$!}")
unless CONFIG[:session_secret] then
raise(::ArgumentError, "Set a :se... |
require 'colorize'
namespace :git do
desc 'Update all git submodules to their current master tip'
task :update do
system('git submodule update --remote')
system(%{git submodule foreach -q --recursive 'branch="$(git config -f $toplevel/.gitmodules submodule.$name.branch)"; git checkout $branch' >/dev/null 2... |
class Student
attr_reader :first_namem :last_name
@@all = []
def initialize(first_name)
@first_name = first_name
@@all << self
end
def self.all
@@all
end
def add_boating_test(test_name, status, instructor)
BoatingTest.new(self, test_name, status, instructor)
end
def self.find_stude... |
# frozen_string_literal: true
class CreateHoldChanges < ActiveRecord::Migration[4.2]
def change
create_table :hold_changes do |t|
t.integer :hold_id, :limit => 8
t.integer :admin_user_id, :limit => 8
t.string :status, :limit => 9
t.text :comment
t.timestamps
end
end
end
|
# frozen_string_literal: true
class ProfileController < ApplicationController
before_action :authenticate_user
def index
@user ||= current_user
load_form_data
render :index
end
def show
index
end
def photo
@user = current_user
@return_path = profile_index_path
render 'users/p... |
# frozen_string_literal: true
require_relative 'msgpack_migration_helper'
Sequel.migration do
helper = MsgpackMigrationHelper.new({
:dynflow_execution_plans => [:data],
:dynflow_steps => [:data]
})
up do
helper.up(self)
end
down do
helper.down(self)
end
end
|
class SessionController < ApplicationController
def new
redirect_to root_url if session[:user_id]
end
def create
if params[:username].empty? || params[:password].empty?
flash.now.alert = 'Username or password is empty'
render :new
else
user = User.find_by(username: params[:username])
i... |
class Offer < ActiveRecord::Base
belongs_to :merchant
attr_accessible :name, :merchant_id
validates :name, presence: true, length: { minimum: 5 }
validates :merchant_id, presence: true
end
|
class Activity < ActiveRecord::Base
KINDS = %w(feed_entry mailing status_update)
belongs_to :team
has_many :comments, -> { ordered }, as: :commentable, dependent: :destroy
validates :content, :title, :team, presence: { if: ->(act) { act.kind == 'status_update' } }
delegate :students, to: :team
class << ... |
require File.expand_path('./lib/delve/version', File.dirname(__FILE__))
Gem::Specification.new do |g|
g.name = 'delve'
g.version = Delve.version
g.date = '2014-03-24'
g.summary = 'Roguelike library inspired by rot.js and libtcod'
g.description = 'Roguelike library inspired by rot.js and... |
module Apohypaton
class ConfigException < StandardError
end
class Config
attr_accessor :url, :token, :enabled, :app_name, :deploy_env, :scheme
# tls also takes: client_cert: '', client_key: '', ca_file: ''
def initialize()
@url = URI(ENV['APOHYPATON_URL'] || 'consul://localhost')
@token... |
class Ability
include CanCan::Ability
def initialize user
user ||= User.new
can :manage, User
can :manage, Game
can :manage, Version
can :manage, Message
end
end
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class StorageTest < Test::Unit::TestCase
def test_basic_operations
@storage = Storage.instance(true)
@storage.flushdb
assert_nil @storage.get('foo')
@storage.set('foo', 'bar')
assert_equal 'bar', @storage.get('foo')
end
def... |
class UserInvitationCode < ApplicationRecord
belongs_to :user
before_create :set_unique_code
def another_user_code?(user)
user_id != user.id
end
private
def set_unique_code
self.code = self.class.unique_code
end
def self.unique_code
code = generate_code
while exists?(code: code)
... |
require 'text/format'
require 'featurist/config'
class TextFormatter
def initialize output_filename, spec
@output_filename = output_filename
@spec = spec
@level = 0
@formatter = Text::Format.new
@formatter.columns = 60
@formatter.first_indent = 0
end
def run
# open the file
File:... |
class Credential < ActiveRecord::Base
acts_as_paranoid
belongs_to :provider, inverse_of: :credentials
end
|
class TeachersController < ApplicationController
def index
@teachers = Teacher.all
render 'index.json.jbuilder'
end
#class Teacher has_many :courses, dependent: :destroy
#删除老师后,老师对应的课程也将删除
def destroy
begin
teacher = Teacher.find(params[:id])
teacher.destroy!
message = "删除成功"
... |
module JsonSpec
module Matchers
class HaveJsonType
include JsonSpec::Helpers
include JsonSpec::Messages
def initialize(type)
@classes = type_to_classes(type)
end
def matches?(json)
@ruby = parse_json(json, @path)
@classes.any?{|c| c === @ruby }
end
... |
class AddIndexesToGcache < ActiveRecord::Migration
def change
add_index :gcaches, :input
end
end
|
# The Jak namespace
module Jak
# The MyAbility Class which is the child of JakAbility
class MyAbility < Jak::JakAbility
def initialize(resource, &block)
# Invoke Jak Ability methods
super do
instance_eval(&block) if block_given?
end
# This is the dynamic permission functionalit... |
class Api::Admin::StatisticsController < Api::BaseController
def show
statistics = StatisticsService.new({current_user: current_user}).call
json_response({ data: statistics})
end
end
|
require 'rubygems'
require File.join(File.dirname(__FILE__), '../lib/isotope')
describe Isotope do
before :all do
@articles = dummy_articles
@template_file = File.join(File.dirname(__FILE__), "article.ejs")
end
it "should output a js template" do
s = Isotope.render_template(@template_file, :id =... |
module Ricer::Plugins::Channel
class Kick < Ricer::Plugin
trigger_is :kick
scope_is :channel
permission_is :halfop
has_setting name: :kickjoin, type: :boolean, scope: :channel, permission: :operator, default: false
has_usage :execute, '<user>'
def execute(user)
reply "Tryi... |
# frozen_string_literal: true
require 'entities/product'
require 'services/application_service'
module Services
module Products
class UpdateProductStock < ApplicationService
include Import[
'contracts.products.update_product_stock_contract',
'repos.product_repo',
]
option :pro... |
class ChangeFieldsToEvent < ActiveRecord::Migration
def change
change_column :events, :price, :decimal
end
end
|
class MassObject
def self.set_attrs(*attributes)
@attributes = []
attributes.each do |att|
attr_accessor att
@attributes << att
end
end
def self.attributes
@attributes
end
def self.parse_all(results)
results.map do|row_hash|
new(row_hash)
end
end
def initialize... |
# == Schema Information
#
# Table name: structure_profiles
#
# id :bigint not null, primary key
# structure_id :bigint
# profile_id :bigint
# status :string
# created_at :datetime not null
# updated_at :datetime not null
#
class StructureProfile < ApplicationRecord... |
RSpec.describe Yaks::Mapper::Association do
include_context 'yaks context'
let(:association_class) {
Class.new(described_class) do
def map_resource(_object, _context)
end
end
}
subject(:association) do
association_class.new(
name: name,
item_mapper: mapper,
rel: rel,
... |
require 'rails_helper'
RSpec.describe Package, type: :model do
let (:shipment_item) { FactoryGirl.create(:shipment_item) }
let (:attributes) do
{
shipment_item_id: shipment_item.id,
package_id: 'ABC123',
tracking_number: 'DEF456',
quantity: 1,
weight: 5.23
}
end
it 'can b... |
class TransfersController < ApplicationController
before_action :set_transfer, only: [:show]
# GET /transfers
# GET /transfers.json
def index
@transfers = Transfer.all
end
# GET /transfers/1
# GET /transfers/1.json
def show
if @transfer.transferaccounts[1].account_id != current_account.id
... |
# Create an ATM Application
# Create a class called Account
# Initialize should take on 3 attributes: name, balance, pin
# Create 4 additional methods: display_balance, withdraw, deposit, and pin_error.
# The user should be prompted to enter their pin anytime they call display_balance, withdraw, or deposit.
# pin_err... |
class Course < ActiveRecord::Base
has_many :enrollments
end
|
# The useful lovely Class Attr Accessor <3
class Square
attr_accessor :side_length
def initialize(side_length)
@side_length = side_length
end
# There was a getter and a setter here!
def perimeter
return @side_length * 4
end
def area
return @side_length * @side_length
end
def to_s
... |
include Java
require "solrmarc_wrapper/version"
require 'logger'
# a way to use SolrMarc objects,
# such as using SolrReIndexer to get a SolrInputDocument from a marc record stored in the Solr index.
class SolrmarcWrapper
attr_accessor :logger
# @param solrmarc_dist_dir distribution directory of SolrMarc buil... |
class ApplicationController < ActionController::API
# something to do with what formats are acceptable if Content-Type: 'application/json' is not specified in the request?
respond_to :json
# rescue_from ActiveRecord::RecordInvalid, with: :record_invalid
# rescue_from ActiveRecord::RecordNotUnique, with: :recor... |
class PasswordResetMailer < ActionMailer::Base
default from: "admin@example.com"
def password_reset_email(password_reset)
@password_reset = password_reset
@user = @password_reset.user
mail(to: @user.email,
subject: "Reset Your Password")
end
end
|
# frozen_string_literal: true
RSpec.describe CollectWorker, type: :worker do
subject(:worker) { described_class.new(operation: operation) }
let(:operation) { instance_spy(SourceOperation) }
context '.perform' do
subject(:perform) { worker.perform }
before do
allow(worker).to receive(:operation).a... |
#
# Class Token - Encapsulates the tokens in TINY
#
# @type - the type of token
# @text - the text the token represents
#
class Token
attr_accessor :type
attr_accessor :text
EOF = "eof"
LPAREN = "("
RPAREN = ")"
WS = "whitespace"
ADDOP = "+"
MINUSOP = "-"
MULTOP = "*"
DIVOP = "/"
EQUALOP = ... |
module BoardsHelper
def check_sidebar_log_in
it "should display", :spam => true do
@selenium.find_elements(:css => "div.sidebar a[class='inner authReturnUrl']").count.should == 1
@selenium.find_element(:css => "div.sidebar a[class='inner authReturnUrl']").displayed?.should be_true
end
it 's... |
LabelGen.configure do |config|
config.qr_url = "http://qr.somedomain.com/items/abc-%{number}/"
config.number_label = "%<number>.05d"
end
|
class CreateSystemMetrics < ActiveRecord::Migration[5.2]
def change
create_table :system_metrics do |t|
t.float :cpu_average_minute
t.integer :memory_used
t.integer :swap_used
t.integer :descriptors_used
t.datetime :get_time
t.references :hot_catch_app, index: true, foreign_key... |
require 'spec_helper'
describe Immutable::List do
describe '#delete' do
it 'removes elements that are #== to the argument' do
L[1,2,3].delete(1).should eql(L[2,3])
L[1,2,3].delete(2).should eql(L[1,3])
L[1,2,3].delete(3).should eql(L[1,2])
L[1,2,3].delete(0).should eql(L[1,2,3])
L['... |
class User < ActiveRecord::Base
has_secure_password
validates :email, presence: true, uniqueness: {case_sensitive: false}
has_many :items
has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>" }, default_url: "/images/:style/missing.png"
validates_attachment_content_type :image, content_type:... |
FactoryBot.define do
factory :fpl_team, class: FplTeam do
name { Faker::Name.unique.name }
association :user, factory: :user
association :league, factory: :league
end
end
|
class AddLevelToCompetitions < ActiveRecord::Migration[5.0]
def change
add_column :competitions, :level, :string, :limit => 3
end
end
|
class Api::V3::EncounterPayloadValidator < Api::V3::PayloadValidator
attr_accessor(
:id,
:patient_id,
:created_at,
:updated_at,
:deleted_at,
:notes,
:encountered_on,
:observations
)
validate :validate_schema
validate :observables_belong_to_single_facility
def schema
Api::... |
class IngredientsController < ApplicationController
before_action :authenticate_admin!
def create
@ingredient = Ingredient.new(name: params["ingredient"]["name"])
if @ingredient.save
redirect_to home_path
else
render 'new'
end
end
def new
@ingredient = Ingredient.new
end
d... |
require 'spec_helper'
MARLA_USERNAME = 'marla.singer@gmail.com'
MARLA_PASSWORD = 'cancer'
def register_marla
visit new_user_url
fill_in 'user_username', with: MARLA_USERNAME
fill_in 'user_password', with: MARLA_PASSWORD
click_on 'Create User'
end
def sign_in_as_marla
visit new_user_url
fill_in 'session_u... |
require 'pry'
require './rule_based_translator.rb'
require './simple_equation_solver.rb'
class Student
extend RuleBasedTranslator
class << self
attr_accessor :student_rules
def format_symbols(string)
string = string.dup
symbols = [".", ",", "%", "$", "+", "-", "*", "/"]
symbols.each { ... |
require File.expand_path(File.dirname(__FILE__) + "/../lib/simple_record")
class MyModel < SimpleRecord::Base
has_attributes :created, :updated, :name, :age, :cool, :birthday
are_ints :age
are_booleans :cool
are_dates :created, :updated, :birthday
end |
require './spec/spec_helper.rb'
RSpec.describe RPNCalculator do
before :all do
@calculator = RPNCalculator.new
end
it "zeroes out invalid input" do
allow($stdin).to receive(:gets).and_return('ok', 'q')
expect { @calculator.run }.to output(/0/).to_stdout
end
it "allows integer input" do
... |
class Cuba
include Headers
include Cors # cors helper methods (headers)
attr_accessor :content_type
# some handy methods to use inside Cuba.define
def logfile
@logfile ||= File.open(File.join(APP_ROOT, 'logs', 'proxy.log'), 'a+')
end
def logger
@logger ||= Logger.new logfile
end
# extra... |
#Day3.rb
#Ruby - Chapter 2, Day 3 Self-Study
puts "Task: Modify the CSV application to support an each method to return a CsvRow object."
class CsvRow
attr_accessor :headers, :values
def initialize(headers, values)
@headers = headers
@values = values
end
def method_missing(name, *args)
index =... |
#
# This file is a stand-in that allows for the generation of rdoc documentation
# for the IBRuby extension for the Ruby programming language. The extension
# is coded in C and documented with Doxygen comments, so this file is used to
# generate the native Ruby documentation instead.
#
#
# This module contains... |
class IsValidUrlValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
begin
endpoint = URI.parse(value)
rescue URI::Error
record.errors.add(attribute, 'Malformed URI')
return false
end
unless endpoint.scheme
record.errors.add(attribute, 'Please sp... |
require 'rails_helper'
RSpec.describe Artist, type: :model do
it { should validate_presence_of :name }
it { should have_many :tracks }
it "is valid after creation" do
artist = build :artist
expect(artist.valid?).to be true
end
end
|
class RemindersController < ApplicationController
before_filter :authenticate_user!
def new
@kid = Kid.find(params[:kid_id])
@reminder = @kid.reminders.build
end
def create
@kid = Kid.find(params[:kid_id])
@reminder = @kid.reminders.create(reminder_params)
if @reminder.save
redirect_... |
require 'bundler/gem_tasks'
require 'github/markup'
require 'redcarpet'
require 'rspec'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'yard'
require 'yard/rake/yardoc_task'
require 'colorize'
args = [:spec, :make_bin_executable, :yard, :rubocop, :check_binstubs]
YARD::Rake::YardocTask.new do |t|
... |
# coding: utf-8
Gem::Specification.new do |s|
s.name = 'simple-currency-converter'
s.version = '0.0.6'
s.authors = ['RETAILCOMMON DEV (Scott Chu, Justine Jones, Jeff Li, Greg Ward)']
s.email = ['dev@retailcommon.com']
s.summary = 'Web client to retrieve currency exchange rat... |
class User < ApplicationRecord
has_many :microposts
validates :email, presence:true
validates :name, presence:true
end
|
require 'test_helper'
class D2L::MeasurementTest < Minitest::Unit::TestCase
def valid_measurement
D2L::Measurement.new(dataclip_reference: 'ref',
librato_base_name: 'default',
run_interval: 50)
end
def test_validations
assert valid_measurement.valid?
... |
require 'fog'
module Migrant
module Clouds
# Base class for cloud service providers.
# All service providers use Fog to handle bootstrapping servers and running stuff
# Cloud service providers are responsible for starting up the server, setting up ssh
# access with the provided keypair, and (even... |
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
fixtures :teamcommitments, :employees
def test_empty
tsk = Task.new()
assert !tsk.valid?
assert tsk.errors.invalid?(:teamcommitment_id)
assert tsk.errors.invalid?(:employee_id)
assert !tsk.save
end
def test_create_bogus_commi... |
class CpsController < ApplicationController
def index
@sort_by = params[:sort_by] || 'name'
order_by = @sort_by.downcase
order_by = 'created_at' if order_by == 'created'
@cps = Cp.order(order_by)
@cpDetails = Cp.getNumLeaves
respond_to do |format|
format.html # index.html.erb
f... |
if defined?(ChefSpec)
def create_dnsimple_record(name)
ChefSpec::Matchers::ResourceMatcher.new(:dnsimple_record, :create, name)
end
def delete_dnsimple_record(name)
ChefSpec::Matchers::ResourceMatcher.new(:dnsimple_record, :delete, name)
end
def update_dnsimple_record(name)
ChefSpec::Matchers::R... |
require 'showbuilder/builders/model_list_builder'
module Showbuilder
module ShowModelList
#
# show_model_list @products do |list|
# list.show_column :x_field
# list.show_text_column :x_field
# list.show_currency_column :x_field
# list.show_percent_colu... |
class Api::V1::TiporeporteController < Api::V1::BaseController
respond_to :json
def index
tiporeporte = Tiporeporte.all
render json: tiporeporte
end
def show
respond_with Tiporeporte.find(params[:id])
end
# Creando tipo reporte
def create
... |
# frozen_string_literal: true
class NewsItemLikesController < ApplicationController
before_action :set_news_item_like, only: %i[show edit update destroy]
def index
@news_item_likes = NewsItemLike.all
end
def show; end
def new
@news_item_like = NewsItemLike.new
end
def edit; end
def create
... |
class ContactoSerializer < MongoidSerializer
attributes :nombre, :email, :telefono
end
|
require 'couchrest_model'
class Audit < CouchRest::Model::Base
use_database "audit"
before_save :set_site_type, :set_user_id
def audit_id=(value)
self['_id']=value.to_s
end
def audit_id
self['_id']
end
property :record_id, String # Certificate/Child id
property :audit_type, String # Qualit... |
class ConditionIsXmage < ConditionSimple
def match?(card)
card.xmage?(@time)
end
def metadata!(key, value)
super
@time = value if key == :time
end
def to_s
timify_to_s "game:xmage"
end
end
|
class Post < ApplicationRecord
belongs_to :city
validates :title, presence: true
validates :text, presence: true
end
|
##########################################################################
# Copyright 2016 ThoughtWorks, 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/li... |
require 'rails_helper'
require 'capybara/rails'
require 'capybara/rspec'
describe 'Item Manipulation', type: :feature do
around(:each) do |example|
DatabaseCleaner.start
example.run
DatabaseCleaner.clean
end
context 'as an unauthenticated user' do
let(:item) { FactoryGirl.build(:item) }
let(... |
require_relative '../../../spec_helper'
describe ::Composer::Package::AliasPackage do
let(:package){ build :complete_package, name: 'foo', version: '1.0' }
let(:alias_package){ build :alias_package, alias_of: package, version: '2.0' }
[
:type,
:target_dir,
:extra,
:installation_source,
... |
require 'io/console'
class Move
MOVE_VALUES = { 'r' => 'rock',
'p' => 'paper',
'sc' => 'scissors',
'sp' => 'spock',
'l' => 'lizard' }
WHAT_BEATS_WHAT = { 'rock' => ['scissors', 'lizard'],
'paper' => ['spock', 'rock'],
... |
Rails.application.routes.draw do
get 'test/search'
get 'test/index'
get 'test/test'
root 'movies#search'
post '/search', to: 'movies#find'
get '/search', to: 'movies#search'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.