text stringlengths 10 2.61M |
|---|
source 'https://rubygems.org'
ruby '2.6.3'
gem 'bootsnap', require: false
gem 'jbuilder', '~> 2.0'
gem 'pg', '~> 0.21'
gem 'puma'
gem 'rails', '6.0.2.1'
# gem 'redis'
gem 'autoprefixer-rails'
gem 'font-awesome-sass', '~> 5.12.0'
gem 'webpacker'
gem 'faker'
gem "animate-rails"
# gem 'animate.css-rails', '~> 3.2.0'
g... |
class Booking < ApplicationRecord
belongs_to :user
belongs_to :experience
belongs_to :schedule
has_many :events, dependent: :destroy
end
|
# coding: utf-8
describe SQLiterate::LiteralsParser do
def parse(q)
SQLiterate::LiteralsParser.new.parse q
end
def should_parse(q)
r = parse q
expect(r).not_to be_nil
r
end
def should_reject(q)
expect(parse q).to be_nil
end
it "parses an integer" do
should_parse("42")
end
... |
class Game < ActiveRecord::Base
attr_accessible :map, :player
validates :player, :presence => :true
validates :map, :presence => :true
end
|
#!/usr/bin/env ruby
#fizzbuzz practice
def fizzbuzz (n)
fb = ''
case
when n % 15 == 0
fb = "FizzBuzz"
when n % 5 == 0
fb = "Buzz"
when n % 3 == 0
fb = "Fizz"
else
fb = n.to_s
end
return fb
end
def fb_array(n)
num_list = [*1..n]
fb_list = []
... |
actions :create
default_action :create
attribute :instance_name, :name_attribute => true, :kind_of => String, :required => true
attribute :distribution, :kind_of => String, :required => true, :equal_to => ['mysql', 'mariadb'], :default => node['multi_mysql']['default_package']['distribution']
attribute :version, :kind_... |
# encoding: utf-8
require "tunemygc/version" unless defined? TuneMyGc::VERSION
module TuneMyGc
HOST = (ENV['RUBY_GC_TUNE_HOST'] || "tunemygc.com:443").freeze
HEADERS = { "Content-Type" => "application/json",
"Accept" => "application/json",
"User-Agent" => "TuneMyGC #{TuneMyGc::VERSION}... |
class TimelinesController < ApplicationController
def show
@events = current_user.events.sort_by(&:date)
end
end
|
class CreateHolidayRequests < ActiveRecord::Migration
def change
create_table :holiday_requests do |t|
t.integer :employee_id
t.boolean :authorised, default: false
t.integer :authorised_by_id
t.timestamps
end
end
end
|
class AddDevelopmentTypeToDevelopment < ActiveRecord::Migration
def change
add_column :developments, :development_type_id, :integer
end
end
|
class CreateOrders < ActiveRecord::Migration[5.2]
def change
create_table :orders do |t|
t.integer :order_purchase
t.datetime :purchase_date
t.string :sub_post_code
t.string :sub_address
t.timestamps
end
end
end
|
# -*- coding: utf-8 -*-
=begin
Faça um programa que receba o valor de uma dívida e mostre uma tabela com os
seguintes dados: valor da dívida, valor dos juros, quantidade de parcelas e valor
da parcela.
Os juros e a quantidade de parcelas seguem a tabela abaixo:
Quantidade de Parcelas % de Juros sobre o valor inicial ... |
# frozen_string_literal: true
module Api
class ChatsController < ApiController
include(ChatHelper)
before_action :set_chat
skip_before_action :set_chat, only: %i[index create messages]
after_action :verify_authorized, except: %i[index show create join leave]
ChatReducer = Rack::Reducer.new(
... |
require 'test_helper'
class KickspostTest < ActiveSupport::TestCase
def setup
@user = users(:mysize1)
@kickspost = @user.kicksposts.build(brand: "Nike",
title: "Air max",
color: "Royal",
... |
# frozen_string_literal: true
# Utility Model
class Utility < ApplicationRecord
belongs_to :step
belongs_to :utensil
validates :utensil_id, uniqueness: { scope: :step_id }
end
|
require 'securerandom'
class Order < ApplicationRecord
before_create :order_track_id
after_initialize :default_values
enum type_of_service: {
speed_post: '1',
regular: '2'
}
enum payment_mode: {
cod: '1',
pre_paid: '2'
}
enum status: {
sent: '0',
... |
#Building Class
require 'pry'
require 'pry-byebug'
class Building
attr_accessor :name, :address, :apartments
#hint apartments should be an array i.e @apartments = []
def initialize(name, address)
@name = name
@address = address
@apartments = [ ]
end
#within an instance method, the building knows ... |
module Legion
module Transport
class Queue < Legion::Transport::CONNECTOR::Queue
include Legion::Transport::Common
def initialize(queue = queue_name, options = {})
retries ||= 0
@options = options
super(channel, queue, options_builder(default_options, queue_options, options))
... |
require 'active_support/all'
require 'secrets/version'
require 'secrets/loader'
require 'secrets/railtie' if defined?(Rails)
module Secrets
class << self
def file
@@file ||= 'config/secrets.yml'
end
def file=(file)
@@file = file
end
def configure
yield self
end
... |
class ChangeDataPhoneNumberToSendingDestinations < ActiveRecord::Migration[5.0]
def change
change_column :sending_destinations, :phone_number, :string
end
end
|
require 'rails_helper'
RSpec.describe SupplyTeachers::Term, type: :model do
subject(:terms) { described_class.all }
let(:first_term) { terms.first }
let(:all_codes) { terms.map(&:code) }
it 'loads terms from CSV' do
expect(terms.count).to eq(5)
end
it 'populates attributes of first term' do
expe... |
class Message < ApplicationRecord
validates :contents, presence: true
has_many :favorites, dependent: :destroy
has_many :user, through: :favorites
end
|
class CreateQuotations < ActiveRecord::Migration[5.1]
def change
create_table :quotations do |t|
t.belongs_to :deal, foreign_key: true
t.belongs_to :discount, foreign_key: true
t.belongs_to :job_request, foreign_key: true
t.string :payment_term
t.integer :discount_value
t.strin... |
require "qq/version"
require 'debug_inspector'
def jsk
QQ::qq no="what"
end
module QQ
def self.qq(*args)
parent_binding = RubyVM::DebugInspector.open{|i| i.frame_binding(2) }
local_variables = parent_binding.local_variables
called_with = args.each_with_index.reduce([]) { |acc, value_index|
arg... |
require File.dirname(__FILE__) + '/../test_helper'
class DiaryEntryControllerTest < ActionController::TestCase
fixtures :users, :diary_entries, :diary_comments
def test_showing_new_diary_entry
get :new
assert_response :redirect
assert_redirected_to :controller => :user, :action => "login", :referer =>... |
# noinspection RubyUnusedLocalVariable
class Sum
def sum(x, y)
raise 'Parameter is negative' if x < 0 || y < 0
raise 'Parameter is outside the accepted range' if x > 100 || y > 100
return x + y
end
end
|
class PowerOrdersController < GroupBase
before_action :set_power_order, only: [:show, :edit, :update, :destroy]
before_action :set_groups # カレントユーザの所有する団体を@groupsとする
load_and_authorize_resource # for cancancan
# GET /power_orders
# GET /power_orders.json
def index
@power_orders = []
# 所有する団体のみで絞り込み... |
#!/usr/bin/env ruby
# (c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org>
# Utility to start or stop JRuby service
# Note: this is provided as a convenience to have jruby running in the
# background, e.g. while using CLI utils. It is not intended for normal
# usage of the PlanR application.
require 'plan-r/app... |
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Storage.head_object' do
describe 'success' do
before(:each) do
Google[:storage].put_bucket('fogheadobject')
Google[:storage].put_object('fogheadobject', 'fog_head_object', lorem_file)
end
after(:each) do
Google[:storag... |
#
# Tests de la sous-classe Bdoc::Paragraphe
#
require 'spec_helper'
require_in_other_class 'bdoc'
require_controller 'pisite'
describe Bdoc::Paragraphe do
# -------------------------------------------------------------------
# La classe
# -------------------------------------------------------------------
des... |
require "simplecov"
require "coveralls"
#require "codeclimate-test-reporter"
#CodeClimate::TestReporter.start
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
])
#Coveralls.wear!('rails)
SimpleCov.start "rails" unless ENV["NO_COV... |
#!/usr/bin/env ruby
# :title: PlanR::Content::MetadataNode
=begin rdoc
(c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org>
=end
require 'plan-r/content_repo/node'
module PlanR
module ContentRepo
=begin rdoc
[in-tree documents in a parallel filesystem, allowing document nodes to
have children such as atta... |
json.context do
json.partial! 'api/v1/contexts/show', context: @context
end
|
class CreateNodeGroupNodeGroupAssignments < ActiveRecord::Migration
def self.up
create_table :node_group_node_group_assignments do |t|
t.column :parent_id, :integer, :null => false
t.column :child_id, :integer, :null => false
t.column :assigned_at, :datetime
t.column :c... |
json.array!(@lights) do |light|
json.extract! light, :id, :key, :name
json.url light_url(light, format: :json)
end
|
# -*- encoding : utf-8 -*-
FactoryGirl.define do
factory :user do |f|
f.name 'Church User'
church
end
end
|
class Api::FortunesController < ApiController
protect_from_forgery unless: -> { request.format.json? }
def show
render json: { fortune: Fortune.all.sample }
end
def create
fortune = Fortune.new(text:params[:fortune])
if fortune.save
render json: { fortune: fortune }
else
... |
#create jobs table
Given /the following jobs exist/ do |jobs_table|
jobs_table.hashes.each do |job|
# each returned element will be a hash whose key is the table header.
# you should arrange to add that movie to the database here.
new_job = Job.create!(title: job[:title], description: job[:descriptio... |
require 'rails_helper'
RSpec.describe Debit, type: :model do
before(:each) do
@organization = Organization.create(name: "neworg")
@organization.asset_accounts.create(name: "debitaccount", number: 1)
@debit_account = @organization.asset_accounts.first
@organization.liability_accounts.create(name: "... |
class HomeController < ApplicationController
def index
@creatives = Creative.order(:num_of_votes => :desc).paginate(:page => params[:page], :per_page => 7)
@tags = Tag.most_popular
@users = User.most_popular
end
def switch_theme
if cookies[:theme] == "flatly"
cookies[:theme] = "cyborg"
... |
module OpenAssets
module Protocol
# Represents a transaction output and its asset ID and asset quantity.
class TransactionOutput
include OpenAssets::Util
attr_accessor :value
attr_accessor :script
attr_accessor :asset_id
attr_accessor :asset_quantity
attr_accessor :outpu... |
class DoctorAddsController < ApplicationController
before_action :set_doctor_add, only: [:show, :edit, :update, :destroy]
# GET /doctor_adds
# GET /doctor_adds.json
def index
@doctor_adds = DoctorAdd.all
end
# GET /doctor_adds/1
# GET /doctor_adds/1.json
def show
end
# GET /doctor_adds/new
... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :current_user
def current_user
if session[:user_id]
@current_user = User.find(session[:user... |
require './test/test_helper/'
class GameTest < Minitest::Test
def setup
game_path = './data/samples/game.csv'
team_path = './data/samples/team_info.csv'
game_teams_path = './data/samples/game_teams_stats.csv'
locations = {
games: game_path,
teams: team_path,
game_teams: game_teams... |
class IncomeMethods < ActiveRecord::Migration
def change
create_table :income_methods do |t|
t.string :method
t.references :user
t.timestamps
end
end
end
|
RSpec.configure do |config|
config.before { FactoryBot.rewind_sequences }
config.include FactoryBot::Syntax::Methods
end
|
class AddSecureColumnInBillentries < ActiveRecord::Migration[5.0]
def change
add_column :billentries, :secure, :boolean
end
end
|
class AddAfterwordToSurveys < ActiveRecord::Migration[5.2]
def change
add_column :surveys, :afterword, :text
end
end
|
describe EOTS::EmailKind do
before do
EOTS::reset
end
let(:bcc) { "This is the bcc" }
let(:cc) { "This is the cc" }
let(:footer1) { "This is Footer 1" }
let(:footer2) { "This is Footer 2" }
let(:footer3) { "This is Footer 3" }
let(:from) { "This is the from" }
let(:header1) { "This is Header 1" ... |
class User < ActiveRecord::Base
validates :username, presence: true
validates :email, uniqueness: true
has_many :posts
has_many :comments, through: :posts
has_secure_password
end
|
FactoryGirl.define do
factory :user do
email "john@doe.com"
password "toto42"
unconfirmed_email nil
confirmed_at "2013-04-13 18:28:12"
confirmation_sent_at "2013-04-13 18:25:28"
end
end |
class ItemsController < ApplicationController
def new
@item = Item.new
end
def create
list = List.find_or_create_by(list_name: params[:item][:list])
@item =list.items.new(item_name: params[:item][:item_name])
if @item.save
redirect_to items_path
else
render :new
end
end
de... |
class CreateUsers < ActiveRecord::Migration
def change
create_table :users |t| do
t.string :first_name
t.string :last_name
t.string :email
t.string :encrypted_password
t.timestamps
end
end
end
|
class Fip < ActiveRecord::Base
validates :msa_info, presence: true
belongs_to :msa_info
has_many :zip_codes
end
|
class Image < ActiveRecord::Base
mount_uploader :substance, SubstanceUploader
belongs_to :prototype
validates :substance, presence: true, format: { with: /\A.+\.(jpg|JPG|jpeg|JPEG|png|PNG)\z/}
end
|
class ChangeRequests < ActiveRecord::Migration[5.0]
def change
change_table :requests do |t|
t.remove :name
t.string :first_name
t.string :last_name
t.string :phone
t.string :preferred_method
t.string :preferred_time
end
end
end
|
class CommentsController < ApplicationController
def create
part = Part.find(params[:part_id])
@comment = part.comments.create(comment_params.merge(user: current_user))
respond_to do |format|
format.html {redirect_to @part}
format.js{}
end
end
def destroy
@part = Part.find(params[:par... |
# Write a method that takes a String of digits, and returns the appropriate number as an integer. You may not use any of the methods mentioned above (without using something like `String#to_i`!).
#
# Do not worry about leading + or - signs, nor should you worry about invalid characters; assume all characters will be nu... |
json.status "success"
json.message "user"
json.data do
json.Username @data[:Username]
json.Level @data[:Level]
json.Name @data[:Name]
json.Token @data[:Token]
end
|
class UserController < ApplicationController
skip_before_action :authenticate_user!, only: [:more_info]
layout :choose_layout
def choose_layout
if current_user.nutrition_only
"nutrition"
else
'nav'
end
end
def new
@user = User.new
@measurements = @user.measurements.build
@... |
class FontOverTheRainbow < Formula
head "https://github.com/google/fonts/raw/main/ofl/overtherainbow/OvertheRainbow.ttf", verified: "github.com/google/fonts/"
desc "Over the Rainbow"
homepage "https://fonts.google.com/specimen/Over+the+Rainbow"
def install
(share/"fonts").install "OvertheRainbow.ttf"
end
... |
require 'rails_helper'
RSpec.describe Deposit, type: :model do
it { should validate_presence_of(:account_id) }
it { should validate_presence_of(:member_id) }
it { should validate_presence_of(:currency) }
it { should validate_presence_of(:lodged_amount) }
it { should validate_presence_of(:aasm_state) }
end
|
source 'https://github.com/CocoaPods/Specs.git'
#platform :ios, '9.0'
use_frameworks!
def default_pods
pod 'Alamofire' # Alamofire is an HTTP networking library written in Swift.
pod 'AlamofireNetworkActivityIndicator' # Controls the visibility of the network activity indicator on iOS using Alamofire.
pod 'MBPr... |
# 2) Defina uma função chamada “negativos_positivos”, que deve receber um array de números e que deve retornar outro array com os seguintes 3 números:
# 1. Na primeira posição, o percentual de números do array que são positivos
# 2. Na segunda posição, o percentual de números do array que são zero
# 3. Na última posiçã... |
class ChangeDateFormatInCashExpenses < ActiveRecord::Migration
def change
change_column :cash_expenses, :start_date, :date
change_column :cash_expenses, :end_date, :date
change_column :cash_expenses, :issue_date, :date
change_column :cash_expenses, :due_date, :date
change_column :cash_expenses, :a... |
require 'test_helper'
class SoundFileTest < ActiveSupport::TestCase
test "should not save without file" do
sound = SoundFile.new
assert !sound.save, "Saved the soundfile without a file"
end
test "should not save without name" do
sound = SoundFile.new
assert !sound.save, "Saved the soundf... |
class RemoveDateFromReport < ActiveRecord::Migration
def up
remove_column :reports, :date
end
def down
add_column :reports, :date, :date, :after => :car_id
end
end
|
FactoryGirl.define do
factory :account do
# don't use :cash_account, it's not valid without an account_group_id
# either a borrower or a lender
factory :cash_account, class: Account::CustomerAccount::CashAccount do
credit_or_debit "credit"
factory :lender_cash_account do
account_group... |
require "webrick"
begin
require "webrick/https"
rescue LoadError
end
require "webrick/httpproxy"
module TestWEBrick
NullWriter = Object.new
def NullWriter.<<(msg)
puts msg if $DEBUG
return self
end
module_function
def start_server(klass, config={}, &block)
server = klass.new({
:BindAddr... |
require 'rest-client'
require 'json'
class GetOruloBuildingListService
def initialize(page)
@page = page
end
def call
begin
base_url = "https://www.orulo.com.br/api/v2/buildings?page=#{@page}"
response = RestClient.get(base_url, headers={Authorization: ENV["ORULO_API_KEY"] }) #... |
namespace :dev do
task fake_restaurant: :environment do
Restaurant.destroy_all
101.times do |i|
Restaurant.create!(name: FFaker::NatoAlphabet.alphabetic_code,
opening_hours: FFaker::Time.datetime,
tel: FFaker::PhoneNumber.short_phone_number,
address: FFaker::Address.street_address,
... |
require 'spec_helper'
describe EventPrompt do
self.instance_exec &$test_vars
it "should belong to event" do
player_prompt.should respond_to(:event)
end
it "should belong to player" do
player_prompt.should respond_to(:player)
end
it "should belong to prompt" do
player_prompt.should respond_to... |
# name: Active Directory
# about: Authenticate on Discourse with your Active Directory.
# version: 0.1.0
# author: Chris Wells <cwells@thegdl.org>
#require 'omniauth-ldap'
gem 'pyu-ruby-sasl', '0.0.3.3'
gem 'rubyntlm', '0.1.1'
gem 'net-ldap', '0.3.1'
gem 'omniauth-ldap', '1.0.4'
class ADAuthenticator < ::Auth::Authen... |
class TopicsController < ApplicationController
def index
@topics = Topic.visible_to( current_user ).paginate( page: params[ :page ], per_page: 10 )
authorize @topics
end
def show
@topic = Topic.find( params[ :id ] )
authorize @topic
@posts = @topic.posts.includes( :user ).includes( :comme... |
class Kitten < ApplicationRecord
validates :name, :age, :cuteness, presence: true
validates :age, :cuteness, numericality: { only_integer: true }
validates :cuteness, numericality: { in: 1..100 }
end
|
require './app/flight.rb'
describe Flight do
let(:route){Route.new(:origin=>"London",:destination=>"Dublin",
:cost_pp=>100,:ticket_px=>150,
:min_takeoff=>60)}
let(:plane){Aircraft.new(:name=>"Cessna",
:number_of_seats=>3)}
let(:plane_s... |
class AddEmailInviteToEvents < ActiveRecord::Migration
def change
add_column :events, :email_invite, :text
end
end
|
class Coordinator < ApplicationRecord
def self.import(file)
all_coordinators = []
Coordinator.all.each do |coordinator|
all_coordinators.push(coordinator.username)
end
xlsx = Roo::Spreadsheet.open(file.path)
xlsx.drop(1).each do |row|
username = row[0]
if !all_coordinators.in... |
#!/usr/bin/env ruby
require "rubygems"
require "httpclient"
require "soap/rpc/driver"
require "optparse"
# INSTALL GEMS:
# sudo gem install soap4r --no-ri --no-rdoc
# sudo gem install httpclient --no-ri --no-rdoc
#
# RUN LIKE THIS:
# ruby global_error_file.rb --hostname=lb-n01.example.com --username=admin -... |
directory "#{ENV['HOME']}/Applications"
case node['platform_family']
when "mac_os_x"
dmg_package "virtualbox-osx" do
destination "#{ENV['HOME']}/Applications"
source "http://download.virtualbox.org/virtualbox/4.2.6/VirtualBox-4.2.6-82870-OSX.dmg"
type "mpkg"
end
else
package "virtualbox" do
action :install
... |
require "byebug"
class PolyTreeNode
attr_accessor :value, :parent, :children
def initialize(value)
@value = value
@parent = nil
@children = []
end
def parent=(parent_node)
return @parent = nil if parent_node == nil
self.parent.children.delete(self) if !self.par... |
class Offer < ApplicationRecord
belongs_to :user
has_many :notifications
validates :pickup, :dropoff, :date, :seats, :price, :presence => true
#retrieve offers that were created x amount of days ago from current time and date.
scope :last_x_days, -> (x) { where(created_at: x.days.ago..Time.zone.now) }
end
|
# frozen_string_literal: true
class GameChannel < ApplicationCable::Channel
def subscribed
@game = Game.find(params[:id])
return reject if @game.status == 'played'
stream_from "game_#{@game.id}"
return unless player?
manage_game
end
def received(data)
return if player? == false || data... |
class AddIsMenuToPizzas < ActiveRecord::Migration
def change
add_column :pizzas, :is_menu, :boolean
end
end
|
class CreditCard < ApplicationRecord
belongs_to :user
has_many :order, dependent: :destroy
end
|
#!/usr/bin/ruby
DIR=File.dirname(__FILE__)
$:.unshift DIR+"/../ext/id3lib"
$:.unshift DIR+"/../lib"
require 'test/unit'
require 'id3lib'
class ID3LIB_TEST < Test::Unit::TestCase
def read_id3
ID3lib.new( "#{DIR}/test.mp3" )
end
def test_attrs
id3=read_id3
id3.each_possible_tag d... |
require 'usdt/stubs/probe'
module USDT
class Provider
attr_reader :provider, :mod
def self.create(provider, mod)
new(provider, mod)
end
def initialize(provider, mod)
@provider = provider
@mod = mod
end
def enable
true
end
def disable
true
end
... |
class CreateVisits < ActiveRecord::Migration
def change
create_table :visits do |t|
t.integer :sparc_id
t.references :line_item, index: true
t.references :visit_group, index: true
t.integer :research_billing_qty
t.integer :insurance_billing_qty
t.integer :effort_billing_qty
... |
require 'test_helper'
module Api
class ContactTest < ActiveSupport::TestCase
setup do
@contact = Contact.new
end
test "should not save without key" do
assert_not @contact.save
end
test "should save if there is a key provided" do
@contact.key = 'my_awesome_key'
assert @co... |
require 'test_helper'
class ProjectEmployeesControllerTest < ActionController::TestCase
setup do
@project_employee = project_employees(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:project_employees)
end
test "should get new" do
get :ne... |
require 'rails_helper'
describe CommentsController do
let(:user) { create(:user) }
let(:question) { create(:question, user_id: user.id) }
let!(:answer) { create(:answer, question_id: question.id, user_id: user.id, best: false) }
let!(:comment) { create(:comment, commentable: question, user: user) }
let!(:co... |
class AddPvalueToSpectrumResults < ActiveRecord::Migration
def self.up
add_column(:spectrum_results, :prob, :float)
end
def self.down
drop_column :spectrum_results, :prob
end
end
|
include_recipe 'directory_helper'
home_dir = DirectoryHelper.home(node)
home_path = "#{home_dir}/" + node[:user]
LINUXBREW_PREFIX = "#{home_path}/.linuxbrew".freeze
execute "Make directory for linuxbrew" do
user node[:user]
command "mkdir -p #{LINUXBREW_PREFIX}"
not_if "test -d #{LINUXBREW_PREFIX}"
end
git "#{... |
class Api::ApiController < ApplicationController
respond_to :json
self.responder = ApiResponder
include NoJSONRoot
include JSONErrorHandling
include TokenAuthenticatable
protect_from_forgery with: :exception
protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/jso... |
module CDI
module V1
class CyclePlanningQuestionSerializer < ActiveModel::Serializer
root false
attributes :id, :question_template_id ,:title, :subtitle,
:question_type, :instructions, :choices
has_many :answers,
serializer: SimpleQuestionUserAnswerSerializer
... |
module CamaleonCms
class PostTagDecorator < CamaleonCms::TermTaxonomyDecorator
delegate_all
# return the public url for this post tag, sample: # return basic in this format: http://localhost:3000/tag/31-mytag-title.html
def the_url(*args)
args = args.extract_options!
args[:label] = I18n.t('ro... |
class UpdateViolationStatusForReadings
def self.exec(options)
readings = Reading.where.not(outdoor_temp: nil)
Regulator.new(readings).batch_inspect!(options)
end
end
|
When(/^the client requests for the patient cwad "(.*?)" and filter value "(.*?)" using$/) do |pid, filter |
path = Querycwad.new(pid, filter).path
@response = HTTPartyWithBasicAuth.get_with_authorization(path)
end
|
class ProfileDecorator < Draper::Decorator
delegate_all
def online_status
return '' unless object.user.last_seen
if online?
'Online'
else
"Last seen #{h.time_ago_in_words(object.user.last_seen)} ago"
end
end
def full_name
"#{object.first_name} #{object.last_name}"
end
def ... |
class CreateContests < ActiveRecord::Migration
def change
create_table :contests do |t|
t.string :contestName
t.datetime :startDateTime
t.datetime :endDateTime
t.string :contestStatus
t.references :user, index: true
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.