text stringlengths 10 2.61M |
|---|
module Shipwire
class Products::VirtualKit < Products
protected
def product_classification
{ classification: "virtualKit" }
end
end
end
|
# encoding: utf-8
class Admin::NewsController < Admin::AdminController
def index
@news = News.order('id desc')
end
def new
#
end
def create
@news = News.new news_params
if @news.save
redirect_to admin_news_index_path
else
render 'new'
end
end
def edit
@news = New... |
class Api::V1::Merchants::MerchantInvoicesController < ApplicationController
def index
@merchant = Merchant.find(params[:merchant_id])
@invoices = @merchant.invoices
end
end
|
module Fog
module Compute
class ProfitBricks
class Request < Fog::Models::ProfitBricks::Base
identity :id
# properties
attribute :method
attribute :headers
attribute :body
attribute :url
# metadata
attribute :created_date, :aliases => 'cre... |
module CliTasks
VERSION = '0.0.8' unless const_defined? :VERSION
if ENV['CLIT_ENV'] == 'test'
TEST_VERSION = '0.0.1' unless const_defined? :TEST_VERSION
end
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.feature "View Search Results", type: :system, clean: true, js: false, style: true do
before do
solr = Blacklight.default_index.connection
solr.add([test_record_0, test_record_1, test_record_2, test_record_3])
solr.commit
# visit '/catalog/211... |
require 'octokit'
require 'kachikachi/pull_request'
module Kachikachi
class GitHub
attr_accessor :client
def initialize(options)
@options = options
end
def pull_requests
pull_request_numbers = @options['pull-request-numbers']
return pull_request_numbers.map { |number| PullRequest.... |
class SearchController < ApplicationController
skip_before_filter :authenticate_user!
respond_to :json, :js
def topics
if logged_in?
@results = Topic.where("title LIKE :input",{:input => "%#{params[:query]}%"}).reject{|k| current_user.blocks.map{|u| u.blocked_id}.include? k.user.id}
else
@re... |
json.array!(@modulo_rols) do |modulo_rol|
json.extract! modulo_rol, :id, :paciente_id, :institucion, :nivel_grado, :direccion, :telefono, :email, :observaciones
json.url modulo_rol_url(modulo_rol, format: :json)
end
|
class Api2::PlacesController < ApplicationController
def audio
@place = Place.find params[:id]
send_file @place.audio.path, :type => "audio/mp3", :filename => "audio.mp3"
end
end
|
class Video < ApplicationRecord
has_many :video_comments
has_many :users, through: :video_comments
end
|
class Account
attr_reader :cleared_balance # accessor method 'cleared_balance
protected :cleared_balance # and make it protected
attr_accessor :balance
def initialize(balance)
@balance = balance
end
def greater_balance_than(other)
return @cleared_balance > other.cleared_balance
end
end
clas... |
# frozen_string_literal: true
module Decorators
module Input
def form=(form)
@form = form
end
def form
@form
end
def input_row(fields, align=nil)
align ||= 'justify-content-around'
h.content_tag :div, class: "form-row #{align}" do
columns(fields)
end
en... |
class AddReferencesToMusicianGenres < ActiveRecord::Migration[5.2]
def change
add_reference :musician_genres, :genre, foreign_key: true
add_reference :musician_genres, :musician, foreign_key: true
end
end
|
class AddPlannedToProgramSizes < ActiveRecord::Migration
def change
add_column :program_sizes, :planned_base, :integer
add_column :program_sizes, :planned_deleted, :integer
add_column :program_sizes, :planned_modified, :integer
add_column :program_sizes, :planed_added, :integer
add_column :program... |
class Text < ActiveRecord::Base
validates :lang, :item_type, :presence => true
#validates :text, :lang, :item_id, :item_type, :presence => true
validates :text, :length => {:in => 2..500, :allow_blank => true }
validates :lang, :inclusion => { :in => I18n.available_locales.map{|loc| loc.to_s}}
validates :it... |
class User < ApplicationRecord
before_save {self.name = name.downcase}
validates :name, presence: true, length:{ maximum:50}, uniqueness: {case_sensitive: false}
has_many :posts, dependent: :destroy
has_many :comments
end
|
class ChangeColumnTypeOfPages < ActiveRecord::Migration
def change
change_column :pages, :access_token, :text
end
end
|
class GeneratedContentsCreate < ActiveRecord::Migration
def self.up
create_table :generated_contents do |t|
t.column :cobrand_id, :integer
t.column :template, :text
t.column :cms_key, :string, :limit => 64
t.column :name, :string, :limit => 64
t.column :data_source_type, :stri... |
require 'rest_client'
require 'json'
require_relative 'config'
require_relative 'domain'
class JamaClient
include RestClient
include JSON
def initialize
@jamaConfig = Config.new
@base_url = @jamaConfig.get_base_url != nil ? @jamaConfig.get_base_url : "none"
@auth = {:username => @jamaConfig.usernam... |
require 'json'
require 'set'
require 'open-uri'
load 'client.rb'
load 'utils.rb'
class Store
attr_accessor :purchases, :products, :client_products, :product_clients
PURCHASES_URL = 'https://mockbin.com/bin/bccf6706-3ae0-44ea-8b12-fc45ae236b04'
CLIENTS_URL = 'https://mockbin.com/bin/b7cf0b01-cc41-4006-a3b7-965c... |
# frozen_string_literal: true
module LdapQuery
# Used to authenticate a users LDAP credentials to a user in LDAP
class Authenticate
attr_accessor :config, :connection
REQUIRED_CONNECTION_KEYS = %i[host username password base].freeze
# Initialzile an ldap connection for authenticating a user
#
... |
Quando("realizo uma requisição GET para o serviço empregados") do
@request_empregado = empregados.list_all_empregados
end
Então('o serviço Empregados deve responder com {int}') do |status_code|
expect(@request_empregado.code).to eq status_code
end
Então("validar lista com todos os empregados cadastrados via... |
require 'rails_helper'
feature 'Visitor search recipe by ' do
scenario 'full type succesfully' do
#arrange
user = User.create(email: 'batata@batato.com', password: 'batatinha')
recipe_type = RecipeType.create(name:'Entrada')
Recipe.create(title: 'Bolo de cenoura', recipe_type: recipe_type,
... |
module EveOnline
module Api
class Client
attr_accessor :api_base
private :api_base=, :api_base
attr_accessor :cache
private :cache=, :cache
attr_accessor :logger
private :logger=, :logger
def initialize options = {}
self.api_base = options[:api_base] || 'http:/... |
class User < ActiveRecord::Base
include Average
has_secure_password
has_many :ratings, dependent: :destroy
has_many :beers, through: :ratings
has_many :memberships, dependent: :destroy
has_many :beer_clubs, through: :memberships
validates :username, uniqueness: true,
length: { minimum: 3, max... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
validates :first_name, presence: true
validates :l... |
# frozen_string_literal: true
class PlanningController < ApplicationController
def events
res = []
events = Event.between(params[:start], params[:end])
.includes(:employee, :area)
events.each do |event|
res << {
id: event.id,
title: event.employee.display_name,
... |
class AddSavedRoutes < ActiveRecord::Migration
def up
add_column :routes, :saved, :integer, default: 1
end
def down
remove_column :routes, :saved
end
end
|
=begin
#VisWiz.io API Documentation
#This SDK allows you to query and create new projects, builds or images within the VisWiz service.
OpenAPI spec version: 1.1.0
Contact: support@viswiz.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.0-SNAPSHOT
=end
require 'uri'
... |
require 'pry'
require 'rest-client'
require 'json'
puts 'Which kind of cultral institution would you like to search?'
requested_institution = gets.strip
# Define the URL that we want to fetch, put .json at end of URL in browser to view JSON
url = "https://data.cityofnewyork.us/api/views/733r-da8r/rows.json"
# Fe... |
Pod::Spec.new do |s|
s.name = "BGTableViewRowActionWithImage"
s.version = "0.3.0"
s.homepage = "https://github.com/benguild/BGTableViewRowActionWithImage"
s.screenshots = "https://raw.github.com/benguild/BGTableViewRowActionWithImage/master/demo.jpg"
s.summary = "A v... |
class Quotation < ActiveRecord::Base
belongs_to :shop
belongs_to :shipping_method
validates_presence_of :shop_id, :cart_id, :name, :slug, :skus
before_validation :cleanup_skus
before_save :set_delivery_type_slug
protected
def set_delivery_type_slug
self.delivery_type_slug = delivery_type.parameter... |
require "spec_helper"
describe ReservationMailer do
describe "reservation_notification" do
let(:restaurant) { create(:restaurant) }
let(:reservation) { create(:reservation, restaurant_id: restaurant.id) }
let(:mail) { ReservationMailer.reservation_notification(reservation) }
it "renders the headers"... |
require 'rubygems'
require 'sinatra/base'
class PostCatcher < Sinatra::Base
def log(str)
@env["rack.errors"].write(str + "\n")
end
get "/" do
"Post to '/' and watch the logs to see what comes in."
end
post "/" do
log(params.inspect)
"post received"
end
get "/ping" do
log(params.in... |
class Pokemon < ApplicationRecord
validates :name, presence: true, uniqueness:true
belongs_to :trainer, optional: true
end
|
# -*- coding: utf-8 -*-
require_relative 'pane'
require_relative 'cuscadable'
require_relative 'hierarchy_child'
require_relative 'tab'
require_relative 'widget'
class Plugin::GUI::TabChildWidget
include Plugin::GUI::Cuscadable
include Plugin::GUI::HierarchyChild
include Plugin::GUI::Widget
role :tabchild... |
require "memoized.rb"
class CategoriesController < ApplicationController
before_filter :admin_logged_in?, :except => [:index, :show, :answerica_categorization, :ckeywords]
protect_from_forgery :except => [:answerica_categorization]
def index
@title = "Categories"
@categories = Category.all(:parent_id => nil)... |
module Workarea
module Upgrade
class Diff
class WorkareaFile
attr_reader :relative_path
def self.find_files(root)
Dir.glob("#{root}/**/*")
.map { |f| f.gsub("#{root}/", '') }
.select do |relative|
!File.directory?("#{root}/#{relative}") &&
... |
require './complejo'
require 'test/unit'
class TestComplejo < Test::Unit::TestCase
def setup
@valor1 = Complejo.new(1,2)
@valor2 = Complejo.new(3,4)
end
def test_simple
assert_equal("(4,6)",(@valor1+@valor2).to_s)#SUMA
assert_equal("(-2,-2)", (-@valor2 + @valor1).to_s)#RESTA
assert_equal("... |
class ContestWorkMember < ApplicationRecord
belongs_to :contest_work
validates :first_name, presence: true, length: {in: 2..16}, custom_name: true
validates :last_name, presence: true, length: {in: 2..16}, custom_name: true
validates :patronymic, presence: true, length: {in: 2..16}, custom_name: true
validates :u... |
# frozen_string_literal: true
class RemoveDefaultOnPointsForCompletions < ActiveRecord::Migration[5.1]
def change
change_column_default :completions, :points, from: 0, to: nil
end
end
|
require "rails_helper"
RSpec.describe ConversationPolicy do
describe "#view?" do
it "returns true for an admin user" do
user = build_stubbed(:user_with_number, :admin)
conversation = build_stubbed(:conversation)
policy = described_class.new(user, conversation)
result = policy.view?
... |
class Project < ApplicationRecord
belongs_to :portfolio
has_many :project_skills
has_many :skills, through: :project_skills
# accepts_nested_attributes_for :skills, allow_destroy: true, reject_if: :all_blank
has_attached_file :image, styles: { large: "500x500>", medium: "300x300>", thumb: "100x100>... |
class RoomAssignmentsController < ApplicationController
before_action :set_room_assignment, only: [:show, :update, :destroy]
# GET /room_assignments
def index
@room_assignments = RoomAssignment.all
render json: @room_assignments
end
# GET /room_assignments/1
def show
render json: @room_assign... |
class User < ActiveRecord::Base
#ActiveRecord::Baseとするとモデルができる機能を全てできるようになる
# Include default devise modules.
devise :rememberable, :omniauthable
include DeviseTokenAuth::Concerns::User
def client
oauth_config = YAML.load_file("#{Rails.root}/config/omniauth.yml")[Rails.env].symbolize_keys!
... |
class FavouriteSerializer < BaseSerializer
cached
self.version = 9
attributes :id, :user_id, :name, :uri, :favorable_type, :favorable_id, :date, :position
def date
object.updated_at.to_time.iso8601
end
def cache_key
self.class.cache_key << [object, object.updated_at]
end
end
|
# Контроллер списка товаров дизайнера
# /designers/#{designer_id}/items
class Admin::DesignItemsController < Admin::BaseController
include MultilingualController
before_action :set_designer
before_action :set_design_item, only: [:show, :edit, :update, :destroy]
# GET /design_items
# GET /design_items.json
... |
require "rails_helper"
RSpec.describe MatchedEffortCategoryValidator do
subject { build(:matched_effort, organisation: create(:matched_effort_provider)) }
context "when the category is applicable to the funding type" do
it "is valid" do
subject.funding_type = "in_kind"
subject.category = "staff_ti... |
require 'spec_helper_acceptance'
if fact('osfamily') != 'Suse'
describe "Elasticsearch class:" do
cluster_name = SecureRandom.hex(10)
case fact('osfamily')
when 'RedHat'
package_name = 'elasticsearch'
service_name = 'elasticsearch'
url = 'http://download.elasticsearch.org/elasticsearch/el... |
class ThemesController < InheritedResources::Base
respond_to :html, :except => :show
layout 'manager_cms'
before_filter :set_active_theme
def create
create! { edit_theme_url(@theme) }
end
def update
update! { edit_theme_url(@theme) }
end
def activate
@theme = Theme.find(params[:i... |
class AuthenticationController < ApplicationController
skip_before_action :require_login
def login
@user = User.find_by(password: params[:password])
if @user
@user.update token: SecureRandom.uuid
render json: @user.as_json(only: [:avatar, :username, :token])
else
render html: 'Wrong P... |
# Displaying Phone Numbers
# create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) => returns "(123) 456-7890"
# Pseudo-code solution
# 1. Start off with an array of numbers
# n. Finish with returning a string
# // Break up digits to groups of 3, 3 and 4, starting at the beginning
# // 1. Convert to a string
# // a... |
class Complaint < ApplicationRecord
has_many :interests, as: :interestable
end
|
require 'spec_helper'
module UniqueSequence
describe Checker do
describe "#check" do
it "should be true for a valid sequence" do
Checker.check([1,1,2,3,8]).should be_true
end
context "invalid sequences" do
it "should be false for an invalid sum" do
Checker.check([1,1,... |
FactoryBot.define do
factory :job_offer do
title { Faker::Lorem.characters(number: 20) }
explanation { Faker::Lorem.characters(number: 100) }
reward { Faker::Lorem.characters(number: 20) }
end
end |
class ListSerializer < ActiveModel::Serializer
attributes :name, :permissions, :id
has_one :user
def created_at
object.created_at.strftime('%Y-%B-%d')
end
end
|
class Dwelling
attr_reader :address, :city, :state, :zip_code
def initialize(dwelling_info)
@address = dwelling_info[:address]
@city = dwelling_info[:city]
@state = dwelling_info[:state]
@zip_code = dwelling_info[:zip_code]
end
end
|
require File.expand_path "../place_bid", __FILE__
class AuctionSocket
def initialize app
@app = app
@clients = []
end
def call env
@env = env
if socket_request?
socket = spawn_socket
@clients << socket
socket.rack_response
else
# else goes to the next mi... |
require_relative 'transaction'
class TransactionParser
def make_transaction(file, sales_engine=nil)
contents = CSV.open(file, headers: true, header_converters: :symbol)
parse(contents, sales_engine)
end
private
def parse(contents, sales_engine=nil)
contents.map { |row| Transaction.new({
:... |
RSpec.describe "Users can edit a budget" do
before do
authenticate!(user: user)
freeze_time
end
after { logout }
context "when signed in as a beis user" do
let(:user) { create(:beis_user) }
let!(:activity) { create(:programme_activity, organisation: user.organisation) }
let!(:budget) { cre... |
require 'formula'
class Pound < Formula
homepage 'http://www.apsis.ch/pound'
url 'http://www.apsis.ch/pound/Pound-2.6.tgz'
sha1 '91ba84c6db579b06dc82fceb790e55e344b1dc40'
depends_on 'pcre'
def install
# find Homebrew's libpcre
ENV.append 'LDFLAGS', "-L#{HOMEBREW_PREFIX}/lib"
system "./configur... |
class DrugInfo
attr_accessor :drug_name, :dose_form
def self.format_results(name, drugs)
d = DrugInfo.new
d.drug_name = name
d.dose_form = drugs.uniq(&:dosage_form_name).map(&:dosage_form_name)
d
end
end |
require 'rails_helper'
RSpec.describe Population, type: :model do
it "should accept a year we know and return the correct population" do
expect(Population.get(1900)).to eq(76212168)
expect(Population.get(1990)).to eq(248709873)
end
it "should accept a year we don't know and return result based on linea... |
class Department < ApplicationRecord
has_many :employments
validates :name, presence: true, length: {maximum: 40}
validates :leader, presence: true
end
|
#!/usr/bin/env ruby
require "json"
require "pry-byebug"
BANK_SIZE = Integer("4000", 16)
ROM_FILE = ENV.fetch("ROM_FILE", "./crystal-speedchoice.gbc")
ROM_FILE_BASENAME = File.basename(ROM_FILE, File.extname(ROM_FILE))
SYM_FILE = "#{ROM_FILE_BASENAME}.sym"
OUT_FILE = "#{ROM_FILE_BASENAME}-label-details.json"
# there... |
require 'rails_helper'
describe Ip, type: :model do
it { is_expected.to be_mongoid_document }
it { is_expected.to validate_presence_of(:address) }
it { is_expected.to validate_presence_of(:values) }
end
|
require 'devise/rails/routes'
require 'devise/rails/warden_compat'
module Devise
class Engine < ::Rails::Engine
config.devise = Devise
# Skip eager load of controllers because it is handled by Devise
# to avoid loading unused controllers.
config.paths.app.controllers.autoload!
config.paths.app.c... |
DIGIT_LIST = {
'0' => 0,
'1' => 1,
'2' => 2,
'3' => 3,
'4' => 4,
'5' => 5,
'6' => 6,
'7' => 7,
'8' => 8,
'9' => 9,
}
def string_to_integer(string)
digits = string.chars.map { |chars| DIGIT_LIST[chars] }
value = 0
digits.each { |digit| value = 10 * value + digit}
value
end
def starting_s... |
require_relative "./helper"
describe "domains" do
it "response should be an array" do
VCR.use_cassette("domains/list_all_dev_domains") do
response = AcquiaToolbelt::CLI::API.request "sites/prod:eeamalone/envs/dev/domains", "GET", {}, false
expect(response.status).to eq 200
JSON.parse(response.b... |
class ItemsController < ApplicationController
require_permission :can_view_and_edit_items?, except: [:index]
require_permission :can_view_items?, only: [:index]
before_action :authenticate_user!
before_action :set_item, only: [:edit, :edit_stock, :update, :destroy]
before_action :set_categories, except: [:upd... |
class Indocker::Configurations::Configuration
attr_reader :name
attr_reader :repositories
attr_reader :registries
attr_reader :build_servers
attr_reader :global_build_args
attr_reader :images
attr_reader :containers
attr_reader :volumes
attr_reader :networks
attr_reader :env_files
attr_reader :art... |
FactoryGirl.define do
factory :asset, class: Asset do
title "Training for test asset"
description "Where training happened"
author "Bejoview Heinkudez"
source "source_name"
purchasable false
price 0.0
asset_type "training"
trait :plan do
asset_type "plan"
association :test... |
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string not null
# password_digest :string not null
# access_token :string not null
# display_name :string
# description :text
# main :str... |
class CreateEvents < ActiveRecord::Migration
def change
create_table :events do |t|
t.string :name
t.text :notes
t.integer :subject_id
t.integer :source_id
t.integer :documentation_id
t.integer :labtime_hr
t.integer :labtime_min
t.integer :labtime_sec
t.intege... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# devolopment machine (requires virtualbox)
# config.vm.define "db_follower", autostart: false
config.v... |
ActiveAdmin.register Department do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# permit_params :list, :of, :attributes, :on, :model
#
# or
#
# permit_params do
# permitted = [:permitted, :attributes... |
####
#
# Address
#
# Why does the class exist?
#
# Represents an address of either a property or a person in the system.
#
# How does it fit in the larger system?
#
# Property, Agent and Clients all require and has_one
# address.
#
####
#
class Address < ApplicationRecord
include AddressDefaults
belongs_to :address... |
require 'rails_helper'
RSpec.describe DevicesController, :type => :controller do
describe "POST create" do
login_user
xit "returns http success" do
stub_devices_controller_with true
post :create, {parse_installation_id: '12345', access_token: @user.authentication_token}
expect(response).to... |
module Natives
class NativesError < StandardError; end
class InvalidCatalogFormat < NativesError; end
end
|
class Home::Indices::RecentliesController < ApplicationController
# GET /home/indices/recentlies
# GET /home/indices/recentlies.json
def index
@home_indices_recentlies = Home::Indices::Recently.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @home_indices_re... |
require 'faker'
FactoryGirl.define do
factory :guardian do
first_name "Jason"
last_name "Doe"
guardian_type "Father"
sequence(:email) { |n| "jasondoe#{n}@example.com"}
address "84 West 84th Street"
after(:build) do |guardian|
[:home_phone, :work_phone, :mobile_phone].each do |phone|
... |
class ProductoControlDetalle < ActiveRecord::Base
attr_accessible :producto_control_id, :producto_id, :cantidad_existencia, :cantidad_verificacion
scope :ordenado_id, -> {order('id')}
belongs_to :producto_control
belongs_to :producto
end
|
class CreatePlacesOccurrencesTable < ActiveRecord::Migration
def self.up
create_table :occurrences_places, :id => false do |t|
t.column :place_id, :integer
t.column :occurrence_id, :integer
end
end
def self.down
drop_table :occurrences_places
end
end
|
class Garage
def initialize
@garage = []
end
def garage(cars)
@garage.push(cars)
end
def garage?
@garage
end
end
|
# frozen_string_literal: true
class FacebookService
def initialize(user)
@user = user
end
def provider
@provider ||= @user.providers.find_by(name: "facebook")
end
def client
@client ||= Koala::Facebook::API.new(provider.token)
end
def uids
client.get_connections(:me, :friends).map { |f... |
class Familiarity < ActiveRecord::Base
belongs_to :user
belongs_to :familiar, :class_name => 'User'
validates_presence_of :user_id, :familiar_id, :familiarness
validates_uniqueness_of :familiar_id, :scope => :user_id
def self.update_all_users
all_combos = User.select("#{User.table_name}.id AS user_id,... |
def login!(user)
session[:session_token] = user.reset_session_token!
end
helper_method :current_user
def current_user
@current_user ||= User.find_by(session_token: session[:session_token])
end
def login!(user)
session[:session_token] = user.reset_session_token!
end
def logout!
current_user.reset_session_token... |
require 'httparty'
gem 'httparty', ">= 0.9.0"
require 'pp'
require 'open-uri'
desc 'Build docs'
task :build_docs do
twitter = "markirby"
name = "Chester WordPress MVC Theme Framework Documentation"
theme = "v1"
issues = true
repo = "markirby/Chester-WordPress-MVC-Theme-Framework"
file = URI::encode(IO.r... |
#
#--
# ripfix (IPFIX for Ruby) (c) 2010 Brian Trammell and Hitachi Europe SAS
# Special thanks to the PRISM Consortium (fp7-prism.eu) for its support.
# Distributed under the terms of the GNU Lesser General Public License v3.
#++
# Extends the InfoModel class for convenient handling of IANA Information
# Elements.
#
... |
require 'spec_helper'
describe "stories/new" do
before(:each) do
assign(:story, stub_model(Story).as_new_record)
render
end
it "has fields" do
expect(rendered).to have_field("Title")
expect(rendered).to have_field("Introduction")
expect(rendered).to have_field("Attachment")
expect(re... |
class Category < ApplicationRecord
has_many :series, class_name: "Serie"
has_many :movies
validates :name, presence: true, uniqueness: true
end
|
# frozen_string_literal: true
require "open3"
require "ox"
module Dmarcurator
module Parser
# Base XML parser
class Base
attr_reader :doc
def initialize(xml: nil, parsed_xml: nil)
if xml
content = File.read(xml)
@doc = Ox.parse(content)
elsif parsed_xml
... |
module Contacts
class API < Grape::API
version 'v1', using: :path
format :json
resource :contacts do
desc "Return a public timeline."
get :timeline do
"abc"
end
end
end
end
|
module ClusterFsck
class Reader
include S3Methods
LOCAL_OVERRIDE_DIR = "clusterfsck"
SHARED_ENV = "shared"
attr_reader :cluster_fsck_env, :key, :version_count
def initialize(key, opts={})
@key = key
@cluster_fsck_env = opts[:cluster_fsck_env] || ClusterFsck.cluster_fsck_env
@i... |
require "confidential-data-server"
require "lucie"
require "lucie/utils"
require "ssh"
class ConfidentialDataClient
include Lucie::Utils
def initialize client_ip, server_ip, debug_options
@client_ip = client_ip
@server_ip = server_ip
@debug_options = debug_options
@ssh = SSH.new( @debug_options ... |
require 'bookmarks'
require 'database_helpers'
describe Bookmarks do
describe '#.all' do
it 'returns all bookmarks stored in class' do
con = PG.connect :dbname => 'bookmark_manager_test'
bookmark = Bookmarks.create(url: "http://www.makersacademy.com", title: "Makers")
Bookmarks.create(url: "... |
class AddFieldsToMember < ActiveRecord::Migration
def change
add_column :members, :name, :string, null: false
add_column :members, :date_of_birth, :date, null: false
add_column :members, :date_raised, :date, null: false
add_column :members, :address, :string, null: false
add_column :members, :empl... |
class Api::V1::DataPointsController < ApplicationController
before_filter :response_headers
respond_to :json
def index
@data_points = DataPoint.where(['start_point >= ?', params[:start] || 0]).limit(params[:size] || 1000)
respond_with @data_points
end
def chromosome
@data_points = DataPoint... |
class CreateDepartments < ActiveRecord::Migration[6.0]
def change
create_table :departments do |t|
t.string :fake_name
t.string :fake_description
t.string :real_name
t.string :real_description
t.timestamps
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.