text stringlengths 10 2.61M |
|---|
# frozen_string_literal: true
require 'evss/response'
module EVSS
module PCIU
class EmailAddressResponse < EVSS::Response
attribute :email, String
attribute :effective_at, String
def initialize(status, response = nil)
attributes = {
email: response&.body&.dig('cnp_email_addr... |
ActiveAdmin.register Message do
permit_params :body, :recipient_id, :sender_id, :read
filter :recipient
filter :sender
filter :read
index do
selectable_column
id_column
column :sender
column :recipient
column :read
column :created_at
actions
end
end
|
class User < ApplicationRecord
before_save { email.downcase! }
# REGEX = Regular expression
# To validate correct email structure
EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :name, presence: true, length: { maximum: 50 }
validates :email, presence: true, length: { maximum: 25... |
class RemoveUniqueNameAndSlugIndicesFromPostCategory < ActiveRecord::Migration
def change
remove_index :post_categories, :name if index_exists?(:post_categories, :name)
remove_index :post_categories, :slug if index_exists?(:post_categories, :slug)
end
end
|
class User < ApplicationRecord
enum role: {user: 0, lecturer: 1}
enum status: {not_assigned: 0, assigned: 1}
has_many :payments
has_many :projects
has_many :messages, dependent: :destroy
has_one :bid
has_one :lecturer
has_one :active_relationship, class_name: "Relationship",
... |
# Clock
class Clock
attr :hours, :minutes, :seconds
def initialize(hours, minutes, seconds)
@hours, @minutes, @seconds = hours, minutes, seconds
end
def print
puts "The current time is #{@hours}:#{@minutes.to_s.rjust(2, "0")}:#{@seconds.to_s.rjust(2, "0")}"
end
def ==(other)
... |
class AddTotalAndNumberReportingToDistricts < ActiveRecord::Migration[5.0]
def change
add_column :districts, :total, :integer
add_column :districts, :number_reporting, :integer
end
end
|
# encoding: utf-8
# Zadanie 1
# Do rozwiązania jest następujący problem:
# mamy tablicę liczb w zmiennej o nazwie 'dane'
#
# po wywolaniu rozwiazanie01(dane) mamy otrzymać tablicę,
# gdzie każdy element będzie większy dwukrotnie
#
def rozwiazanie01(array)
# wskazówka: wykorzystaj metodę #map dla klasy Array
# htt... |
class NodesController < ApplicationController
before_filter :fill_variables
def index
begin
render :json => @model.nodes
rescue
render :text => "record not found", :status => 404
end
end
def show
render :json => @model.nodes.find(params[:id])
end
def create
node = Node.new... |
require 'rails_helper'
RSpec.describe Author::Translator do
describe 'create translate the author names into the pattern' do
it 'returns SILVA, Joao' do
expect(described_class.translate('joao silva')).to eq('SILVA, Joao')
end
it 'returns NETO, Charles' do
expect(described_class.translate('c... |
class AddShortnameToBooks < ActiveRecord::Migration
def change
add_column :books, :shortname, :string
end
end
|
class ChargeIO::Base
include ChargeIO::Connection
attr_reader :gateway, :messages, :errors, :attributes
def initialize(_attributes={})
if _attributes[:gateway].present?
@gateway = _attributes.delete(:gateway)
else
@gateway = ChargeIO::Gateway.new(:site => _attributes.delete(:site) || ChargeIO... |
class WordGame
attr_reader :secret, :guess_count, :word_state, :guesses
# METHOD: initialise word game
# INPUT: secret word as string
# OUTPUT: WordGame instance
def initialize(secret)
@secret = secret
@guess_count = secret.length
@word_state = ["_"] * secret.length
@guesses = []
end
#... |
class Author
attr_accessor :name, :posts
def initialize(name)
@name=name
@posts=[]
end
def add_post(post)
post.author=self
@posts<< post unless @posts.include?(post)
end
def add_post_by_title(post_title)
post=Post.new(post_title)
self.add_post(post)
end
def self.post_coun... |
module Rbacan
class RolePermission < ApplicationRecord
self.table_name = Rbacan.role_permission_table
belongs_to :role, class_name: Rbacan.role_class
belongs_to :permission, class_name: Rbacan.permission_class
end
end
|
require 'spec_helper'
describe Tweet do
before do
@sampletweet = Tweet.new(status: "Testing Tweet Status", user_id: 99 )
end
subject { @sampletweet }
it { should respond_to(:status) }
it { should respond_to(:user_id) }
it { should be_valid }
# Testing tweet Status for blanks and over 140 chars
describe "when status i... |
class FontIbmPlexSerif < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/ibmplexserif"
desc "IBM Plex Serif"
homepage "https://fonts.google.com/specimen/IBM+Plex+Serif"
def install
(share/"fonts").install "IBMPlexSerif-Bold.ttf"
(s... |
require "sinatra"
require 'telegram/bot'
require 'multi_json'
set :port, ENV["PORT"] || 5666
def json_load(request_body)
request_body.rewind
body = request_body.read
MultiJson.load body
end
post '/:token' do |token|
Telegram::Bot::Client.run(token.to_sym) do |bot|
if bot
data = json_load(request.b... |
module OpenTriviaDB
class Answer
attr_reader :text, :correct
attr_accessor :letter
def initialize(text:, correct:)
@text = text
@correct = correct
end
def self.build_list(answers, correct:)
Array(answers).map do |answer|
new(text: answer, correct: correct)
end
... |
require 'test_helper'
class GitConcernTest < Minitest::Test
class Dummy
include GitConcern
end
class DummySearchRepositories
attr_accessor :total_count
def initialize(query)
if query == 'Hello World'
@total_count = 1
else
@total_count = 0
end
end
end
#Ideally we should s... |
FactoryBot.define do
factory :notebook do
user
name { 'Recipes' }
trait :with_notes do
after :create do |notebook|
create_list(:note, 2, notebook: notebook)
end
end
factory :notebook_with_notes, traits: %i[with_notes]
end
end
|
class RemovePantoneCodeAndSleeveFromJobRequests < ActiveRecord::Migration[5.1]
def change
remove_column :job_requests, :sleeve, :string
remove_column :job_requests, :pantone_code, :string
end
end
|
class CreateHashtags < ActiveRecord::Migration[5.1]
def change
create_table :hashtags do |t|
t.string :tweet_id
t.integer :count
t.string :tagname
t.timestamps
end
add_index :hashtags, :tweet_id, unique: true
end
end
|
class SalesController < ApplicationController
helper_method :postcodes, :start_date, :end_date, :frequency, :property_type_params
def index
@sales = sales.paginate(:page => params[:page])
end
def graph
@frequency = params[:frequency] || "weekly"
sales_by_time_group
@ticks = @sales_by_time_gr... |
class AddAssignedToProjects < ActiveRecord::Migration[5.0]
def change
add_column :projects, :assigned, :boolean
end
end
|
class StopStatsController < ApplicationController
# GET /api/stop_stats
def index
@stop_stats = StopStat.all
render json: @stop_stats
end
end |
module Attributable
attr_accessor :attributes
def setAttribute(key, value:)
attributes[key] = value
end
def formattedAttributes
ret = ""
attributes.each do |key, value|
ret += "| key: #{key}\n value: #{value} |\n"
end
ret
end
end
class BaseModel
include Attributable
def in... |
require 'test_helper'
class SubjectsControllerTest < ActionDispatch::IntegrationTest
setup do
@subject = subjects(:one)
end
test "should get index" do
get subjects_url
assert_response :success
end
test "should get new" do
get new_subject_url
assert_response :success
end
test "shoul... |
# Teskal
# Copyright (C) 2007 Teskal
#
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABI... |
module UsersHelper
def role_options
arr = []
User::ROLES.each do |role|
case role
when 'student'
arr << ['Học Sinh', role]
when 'member'
arr << ['Thành Viên', role]
when 'admin'
arr << ['Admin', role]
end
end
arr
end
end
|
require "rails_helper"
describe ProductsShop::PrepareList do
before do
2.times { create(:products_shop) }
end
let(:subject) do
described_class.call(shop_ids, props)
end
context "without additional properties" do
let(:shop_ids) { [Shop.first.id] }
let(:props) { [] }
it "prepares list" do... |
# == Schema Information
#
# Table name: photos
#
# id :integer not null, primary key
# img_url :string not null
# title :string
# description :text
# owner_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# w... |
class SongLyric
attr_accessor :lines
def initialize(lines = []) {}
@lines = lines
end
def to_json(*a)
{ 'lines' => lines }.to_json(*a)
end
end
|
require './spec/helpers'
describe 'Player' do
let(:player){GameEngine::Player.new}
it 'should have a pocket' do
player.pocket.should eq(Pocket.new)
end
it 'should pick dice' do
mocked_game = double('GameEngine::Game')
player.game = mocked_game
mocked_game.should_receive(:pick).with([0, 1, 2])... |
class AddFieldsToAnimals < ActiveRecord::Migration
def change
add_column :animals, :dob, :date
add_column :animals, :food, :string
add_column :animals, :volume_per_serving, :decimal
add_column :animals, :servings_per_day, :integer
end
end
|
class Token < ApplicationRecord
EXPIRATION_TIME = 60 * 60 * 24
before_create :generate_token
belongs_to :ownerable, polymorphic: true
def expired?
(Time.current - created_at).to_i > EXPIRATION_TIME
end
def generate_token
self.value = SecureRandom.uuid
end
def used?
... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
class Loan < ActiveRecord::Base
validates :title, presence: true, uniqueness: true
validates :description, presence: true
validates :price, presence: true, numericality: { greater_than: 0 }
validates :category, presence: true
belongs_to :category
has_attached_file :avatar,
styles: { med... |
class SessionsController < ApplicationController
def new
@user = User.new
end
def create
user = User.find_by(username: params[:username])
redirect_to login_path, {flash: {danger: 'Unknown username or password'}} and return unless user
if user.authenticate(params[:password])
redirect_to login... |
require_relative "boot"
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Diaper
# Bootstraps the application
class Application < Rails::Application
config.to_prepare do
Devise::Ses... |
class Status < ActiveRecord::Base
belongs_to :application
enum current: { closed: 0, open: 1 }
def self.latest
order(created_at: :desc).first || NullStatus.new
end
def self.previous
order(created_at: :desc).offset(1).first || NullStatus.new
end
end
|
require 'rails_helper'
RSpec.describe Admin, :type => :model do
include ModelHelper
let(:new_admin) { Admin.new }
it 'Admin class exists' do
expect(class_exists?(Admin)).to eq(true)
end
it 'Type should equal to Admin' do
expect(new_admin.type).to eq('Admin')
end
it 'Type should equal to Admin' d... |
include ApplicationHelper
RSpec::Matchers.define :have_error_message do |message|
match do |page|
page.should have_selector('div.alert.alert-error', text: message)
end
end
def valid_signin(user)
visit signin_path
fill_in "Email", with: user.email.upcase
fill_in "Password", with: user.password
cli... |
# The basic idea is that I am creating a MenuStrip that is reusable, and can be called directly from any page that inherits it.
# Not your classic "IS-A" relationship, but it does encourage re-use of code.
class AdminAddTourPage < AdminMenuStrip
def initialize(browser)
@browser=browser
Watir::Wait.until { @bro... |
class CreateCommUsers < ActiveRecord::Migration
def change
create_table :comm_users do |t|
t.references :comm, index: true, foreign_key: true
t.references :user, index: true, foreign_key: true
t.timestamps null: false
end
end
end
|
require File.dirname(__FILE__) + '/../test_helper'
class ContactTest < Test::Unit::TestCase
fixtures :conversations, :contacts, :contacts_conversations
def test_read_all_contacts
contacts = Contact.find(:all)
assert_equal 3, contacts.size
end
def test_read_first_contact
contact = Contact.find(1... |
class AddDefaultValueNillToDoctorManagerId < ActiveRecord::Migration[5.0]
def change
remove_column :doctors, :manager_id
add_column :doctors, :manager_id, :integer, default: nil
end
end
|
class Device < ActiveRecord::Base
belongs_to :device_type
belongs_to :client
has_many :phones, :through => :clients
def model
self.device_type.name
end
scope :avaliable, where('client_id is ?', nil)
scope :unavaliable, where("client_id != 'NULL'")
def avaliability
client_id == nil
... |
class User < ApplicationRecord
has_many :inquiries
before_save { self.email = email.downcase } #To store all the emails in DB in down/lowercase
#User validation. Must always be present, Must be unique and
#the length should be between 3 & 50 characters included.
validates :firstname, presence: true,
... |
class Project < ActiveRecord::Base
has_many :tasks, :dependent => :destroy
def find_free_task
self.tasks.available.first rescue nil
end
def to_param
"#{name}"
end
def lock_available_task
Task.transaction do
task = self.find_free_task
task_params = {}
task_params[:lock] = t... |
require_relative "item"
class Terminal
attr_reader :pricing_info, :items
def initialize(pricing_info)
@pricing_info = pricing_info
@items = Hash.new(0)
end
def scan(item)
items[item.to_sym] += 1
end
def total
items.map { |i| Item.new(pricing_info, i).total }
.reduce(:+)
end
en... |
require 'spec_helper'
describe CommentsController do
before(:each) do
@comment = create :comment
@story = @comment.commentable
end
# This should return the minimal set of attributes required to create a valid
# Story. As you add validations to Story, be sure to
# update the return value of this met... |
require 'factory_girl'
Factory.sequence :email do |sequence_number|
"email-#{sequence_number}@example.com"
end
Factory.sequence :login do |sequence_number|
"login-#{sequence_number}"
end
Factory.sequence :app_name do |sequence_number|
"app-#{sequence_number}"
end
Factory.define :user do |user|
user.email { ... |
require_relative '../../spec_helper'
describe DeltaPackBuilder do
before(:context) {
DatabaseCleaner.clean
valid_hoge.save
valid_hoge.save
valid_hoge.save
valid_huga.save
}
let(:builder) { DeltaPackBuilder.new }
describe "#push" do
before(:each) do
builder.push_documents Hoge.a... |
json.alert @alerts do |alert|
json.id alert.id
json.state alert.state
json.beacon_id alert.beacon_id
json.beacon_uuid alert.beacon.uuid
json.beacon_minor alert.beacon.minor
json.beacon_major alert.beacon.major
json.duration alert.duration
end
|
module Fog
module Compute
class Brkt
class Real
def create_zone(network_id, cidr_block, name, options={})
request(
:expects => [201],
:method => "POST",
:path => "v1/api/config/network/#{network_id}/zones",
:body => Fog::JSON.encode({
... |
module Api
module V1
class ProjectsController < V1::ApiController
def show
project = Project.find_by_id(params[:id])
render json: projects_with_emails(project.as_json)
end
def index
projects = Project.where("#{@current_user&.id} = ANY(team_lead_user_ids)").or(Project.w... |
# Copyright 2014 Square 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 required by applicable law or agreed ... |
class MangementsController < ApplicationController
before_action :set_mangement, only: [:show, :edit, :update, :destroy]
before_action :checked_user?
# GET /mangements/1
# GET /mangements/1.json
def show
end
# GET /mangements/new
def new
@mangement = Mangement.new
end
# GET /mangements/1/edit... |
class Passenger
attr_accessor :name
@@all = []
def initialize(name)
@name = name
@@all << self
end
def rides
Ride.all.select {|r| r.passenger == self}
end
def drivers
self.rides.map {|r| r.drivers }
end
def self.all
Passenger.al... |
# frozen_string_literal: true
module GPGenie
class Process
attr_reader :encrypted_file_path
DECRYPTED_FILE_PATH = ENV.fetch('DECRYPTED_FILE_PATH')
PASSPHRASE = ENV.fetch('GPG_PASSPHRASE')
SECRET_KEY = ENV.fetch('SECRET_KEY')
SECRET_KEY_PATH = ENV.fetch('SECRET_KEY_PATH')
... |
#!/usr/bin/env ruby
# file: testdata.rb
require 'app-routes'
require 'testdata_text'
require 'diffy'
require 'polyrex'
class TestdataException < Exception
end
module Testdata
class Base
include AppRoutes
attr_accessor :debug
def initialize(s, options={})
super()
@params = {}... |
class ProfilesController < ApplicationController
before_action :set_profile, only: [:edit, :update, :index, :show]
skip_before_action :authenticate_user!, only: [:index]
def index
respond_to do |format|
format.html
format.json do
@events = Concert.where(band_id: current_user.bands.pluck(... |
# frozen_string_literal: true
require "open-uri"
module Decidim
module Opinions
# A factory class to ensure we always create Opinions the same way since it involves some logic.
module OpinionBuilder
# Public: Creates a new Opinion.
#
# attributes - The Hash of attributes to create t... |
class AddWinCountToTournies < ActiveRecord::Migration
def change
add_column :tournies, :wins, :integer
end
end
|
require 'active_record/base'
require 'active_record/connection_adapters/abstract_adapter'
require "database_cleaner/generic/truncation"
require 'database_cleaner/active_record/base'
require 'database_cleaner/active_record/truncation'
# This file may seem to have duplication with that of truncation, but by keeping them ... |
require "pastel"
namespace :dev do
desc "Configura o ambiente de desenvolvimento!"
task setup: :environment do
if Rails.env.development?
pastel = Pastel.new
opts = {
style: {
top: "- ",
middle: " -- ",
bottom: " -> ",
},
format: :bouncing_ball
... |
require 'test_helper'
class DeviseControllerTest < ActionDispatch::IntegrationTest
test "user edit is disable" do
sign_in users(:admin)
error = assert_raises ActionController::RoutingError do
get edit_user_registration_path
end
assert_equal "Not Found", error.message
end
test "user update... |
class CreateEvaluationTemplates < ActiveRecord::Migration
def self.up
create_table :evaluation_templates do |t|
t.column :account_id, :integer
t.column :question, :text
t.column :question_type, :text
t.timestamps
end
add_index :evaluation_temp... |
require 'active_record'
config = {
adapter: 'mysql2',
encoding: 'utf8',
database: 'activerecord_mysql_unsigned'
}
ActiveRecord::Base.establish_connection(config.merge(database: 'mysql'))
ActiveRecord::Base.connection.drop_database(config[:database]) rescue nil
ActiveRecord::Base.connection.create_database(confi... |
class AlbumTemplatePage < ActiveRecord::Base
belongs_to :album_template
upload_column :logo_phone, :versions => {:thumb400 => "400x400"}, :store_dir=>proc{|picture, file| "album_template_pages/#{picture.created_at.strftime("%Y-%m-%d")}/#{picture.id}/logo_phone"}
upload_column :logo_print, :versions => {:thumb400... |
class Puppy
attr_accessor :name, :age, :breed
def initialize(args)
args.each{|k, v| self.send("#{k}=", v)}
end
end |
class EomodelsController < ApplicationController
def new
@eomodel = Eomodel.new
end
def create
@eomodel = Eomodel.create(eomodel_params)
end
def index
@eomodels = Eomodel.all
end
private
def eomodel_params
params.require(:eomodel).permit(:name)
end
end
|
class Admin::UsersController < Admin::ApplicationController
before_filter :get_user
def edit; end
def update
if @user.update(user_params)
flash[:success] = "You successfully updated info for the user."
redirect_to users_path
else
flash.now[:danger] = "Please check your inputs belo... |
# Shuffle. Now that you’ve finished your new sorting algorithm, how about the opposite? Write a shuffle method that takes an array and returns a to- tally shuffled version. As always, you’ll want to test it, but testing this one is trickier: How can you test to make sure you are getting a perfect shuffle? What would yo... |
FactoryGirl.define do
factory :topic do
# [{"name":"US Citizenship Civic Test","id":{"$oid":"57f54e1a9a158d0003000000"},"description":"Civics (History and Government) Questions for the Naturalization Test"}]
name "US Citizenship Civic Test" #Faker::Lorem.sentence(3, true, 4)
description "Civics (History a... |
class CreateBuses < ActiveRecord::Migration
def self.up
create_table :buses do |t|
t.column :company, :string
t.column :vehicle_type, :string
t.column :bus_stop_downtown, :string
t.column :route_length_km, :decimal, :precision => 5, :scale =>5
t.column :routes_taken, :string
t.... |
# TODO: This is not portable
# TODO: Make this patch-level settable
define :cc_ruby192_src do
patch_level = node[:ruby][:patch_level] || "290"
src_dir = "/usr/local/src"
ruby_ver = "ruby-1.9.2-p#{patch_level}"
ruby_dir = "#{src_dir}/#{ruby_ver}"
tar_file = "#{ruby_dir}.tar.gz... |
module HasFriendship
class Friendship < ActiveRecord::Base
def self.relation_attributes(one, other)
{
friendable_id: one.id,
friendable_type: one.class.base_class.name,
friend_id: other.id
}
end
def self.create_relation(one, other, options)
relation = new relatio... |
require 'rails_helper'
describe ItemsHelper do
let(:item) { FactoryGirl.create(:item) }
describe '#print_time_to_release' do
it 'returns a message for today\'s releases' do
item.release_date = Date.today
expect(helper.print_time_to_release(item))
.to eq t('item.release.today')
end
... |
class NotificationPolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope.all if user.is_a?(Talentist)
end
end
end
|
# require 'bundler/setup'
require 'bunny'
require 'json'
def add(x, y, z)
x + y + z
end
channel = set_up_channel
target_time = 500
EXCHANGE_NAME_FOR_FUNCTION = 'submitted_inputs'
QUEUE_NAME = 'inputs_to_run'
exchange_submitted_inputs = channel.fanout(EXCHANGE_NAME_FOR_FUNCTION)
queue_inputs_to_run = channel.que... |
class AddDateTakenToBmis < ActiveRecord::Migration
def change
add_column :bmis, :date_taken, :date
end
end
|
require 'active_record'
require_relative './item_order.rb'
require_relative './pricing_rule.rb'
class Order < ActiveRecord::Base
belongs_to :currency
has_many :item_orders
has_many :items,
before_add: :validate_item_currency,
after_add: :update_total!,
after_remove: :update_total!,
through: :item... |
require 'spec_helper'
require 'holidays'
describe 'Exchange rates functionality.' do
before(:each) do
@weekend = '2018-01-14'
@holiday = '2018-01-15'
@workday = '2018-01-16'
end
it 'should be holidays' do
expect(ExchangeRateConverter.holiday?(@holiday)).to be true
end
it 'should not be holi... |
require_relative("person")
class Student < Person
Level = 0
def initialize(f,l)
super(f,l)
@knowledge_level = Level
end
end
def learn
@knowledge_level += 10
end
def slack
@knowledge_level -= if knowledge_level >= 5
end
end
stewie = Student.new("stewi... |
class AddZonaToLugares < ActiveRecord::Migration
def change
add_column :lugares, :zona_Id, :integer
end
end
|
class WorkOrder < ActiveRecord::Migration
def change
create_table :work_orders do |t|
t.integer 'work_order_number'
t.string 'project_name'
t.string 'work_order_type'
t.string 'UNO_project_manager'
t.string 'business_owner'
t.string 'program_office'
t.date '... |
require 'pry'
class PigLatinizer
attr_accessor :text
def piglatinize(text)
@text = text
word= @text.split("")
choose_pig_latinize_method(word).join
end
def to_pig_latin(text)
@text = text
split_text.collect do |word|
if word.length <= 2 && starts_with_vowel(word) && word != "it"
... |
# http://www.omnigroup.com/ftp1/pub/software/MacOSX/10.5/OmniGrafflePro-5.3.3.dmg
meta 'skip_eula_prompt' do
accepts_value_for :app_name, :basename
accepts_value_for :source, :source
accepts_value_for :dmg_name
template {
met? {
"/Applications/#{app_name}".p.exist? || "/Applications/#{dmg_name.gsub(/... |
class SubmissionsController < ApplicationController
before_action :fetch_record, only: [:new, :create, :show]
def index
@org = Organization.find(params[:organization_id])
@submissions = @org.submissions
end
private
def submission_params
params.require(:submission).permit(:name, :email)
end
d... |
require File.dirname(__FILE__) + '/setup'
require 'javaclass/classfile/java_class_header'
require 'javaclass/classscanner/imported_types'
module TestJavaClass
module TestClassScanner
class TestImportedTypes < Test::Unit::TestCase
def setup
@public = JavaClass::ClassScanner::ImportedTypes.new(
... |
# celtics_hoodie = {:team => "celtics", :color => "Green", :price => 49.99, :size => "Large"}
# bulls_hoodie = {:team => "bulls", :color => "Red", :price => 59.99, :size => "Large"}
# knicks_hoodie = {:team => "knicks", :color => "Blue", :price => 49.99, :size => "Large"}
# puts "This is a #{celtics_hoodie[:team]} hoo... |
module Notifiers
class PreviewCallbackNotifier
attr_reader :video_preview
def initialize(video_preview)
@video_preview = video_preview
end
def self.notify(video_preview)
new(video_preview).send_callback_notification
end
def send_callback_notification
return if video_previe... |
require 'spec_helper'
describe PostsController do
describe 'routing' do
it 'GET /' do
expect(get '/').to route_to('posts#index')
end
it 'GET /:id' do
expect(get '/test').to route_to('posts#show', id: 'test')
end
it 'POST /posts' do
expect(post '/posts').to route_to('posts#crea... |
class HomeController < ApplicationController
# get all albums to display on the home page
def home
@albums = Album.all
end
def contact
end
def request_contact
# parameters required for contact form
name = params[:name]
email = params[:email]
mobile = params[:mobile]
message ... |
# -*- encoding : utf-8 -*-
require 'rails_helper'
describe 'People Views' do
before :each do
setup.login_with_church :user, :church
admin.add_person_field name: 'Custom Field 1', type: 'String'
admin.add_person_field name: 'Custom Field 2', type: 'True/False'
people.add :person1, fi... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
require 'cloudformation_mapper/resource'
class CloudformationMapper::Resource::AwsPropertiesSqsQueue < CloudformationMapper::Resource
register_type 'AWS::SQS::Queue'
type 'Template'
parameter do
type 'Template'
name :Properties
parameter do
type 'Integer'
name :DelaySeconds
end
... |
Rails.application.routes.draw do
resources :categories
resources :users
resources :likes
resources :replies
resources :comments
resources :articles
post 'authenticate', to: 'authentication#authenticate'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.