text stringlengths 10 2.61M |
|---|
module Antlr4::Runtime
class LexerNoViableAltException < StandardError
end
end |
class PostsController < ApplicationController
before_action :find_post, only: [:show, :edit, :update, :destroy]
# skip_before_action :authorization, only: [:index]
def index
@posts = Post.all
@imgs = [
"https://images.unsplash.com/flagged/photo-1570612861542-284f4c12e75f?ixlib=rb-1.2.1&ixid=eyJhcHB... |
class SignUpsController < ApplicationController
def index
end
def new
@user = SignUp.new
end
def cost
return 10
end
def create
@user = SignUp.new(sign_ups_params)
if @user.save!
UserMailer.welcome_email(@user).deliver
flash[:notice] = "Thank you " + @user.first_name + ",... |
# == Team role
#
# Provides functionality to manage project team
# - add user/users to project
# - update existing membership
# - remove users from project team
#
# Used by Project
#
module Team
def team_member_by_name_or_email(name = nil, email = nil)
user = users.where("name like ? or email like ?", name, em... |
class TimelinelikesController < ApplicationController
def show
@posts = Post.left_outer_joins(:likes).group('posts.id').select('posts.*, COUNT(likes.*) AS likes_count').distinct.reorder(likes_count: :desc).limit(5)
end
end |
class CreateBookTags < ActiveRecord::Migration
def change
create_table :book_tags do |t|
t.references :book
t.references :tag
end
add_index :book_tags, [:book_id, :tag_id]
end
end
|
# -*- coding: utf-8 -*-
# Precisa de correรงรฃo
=begin
Faรงa um progra com esqtoque e opeรงรฃo de vendas. O programa
deve solicitar ao usuรกrio o produto e a quantidade vendida.
Verifique se o nome do produto digitado existe no dicionรกrio,
e sรณ entรฃo efetue a baixa em estoque.
=end
puts("=" * 60)
estoque={ :"tomate" =>... |
class Cargo < ActiveRecord::Base
has_many :boxes
belongs_to :user
validates :flight_number, presence: true
validates :planned_departed, presence: true
validates :planned_landed, presence: true
def to_s
"#{flight_number} #{planned_departed.strftime("%d/%m/%Y %H:%M")}"
end
def self.available
where("planne... |
require 'spec_helper'
describe "31170407 has_sage_flow_states adds validator to test for presence of sage_flow_state field" do
describe "when field is not defined" do
before(:each) do
class StatelessSampleMigration < ActiveRecord::Migration
def up
create_table :stateless_samples do |t|
... |
module Dispatchers::Validation
extend ActiveSupport::Concern
included do
validates :rule, presence: :true
end
end
|
require 'multi_json'
require 'net/https'
require 'optparse'
require 'uri'
require_relative './models/options'
require_relative './models/api_interface'
require_relative './models/unbounce_page'
require_relative './models/unbounce_pages'
# ------------------------------ Main ------------------------------
# Uses an ... |
class Location < ApplicationRecord
belongs_to :restaurant
validates :address, presence: true, uniqueness: true
end
|
# template.rb
require_relative "lib/flask/version"
def source_paths
[File.join(File.expand_path(File.dirname(__FILE__)), 'rails_root')] +
Array(super)
end
def setup_rspec
generate "rspec:install"
run "mkdir -p spec/support/"
copy_file "spec/support/capybara_webkit_rspec.rb"
copy_file "spec/support/data... |
class SaveRow
prepend SimpleCommand
# NOTE: This method is called when user save the basic row info
# @form_object = UpdateRowInfoForm
def initialize(form_object)
@form_object = form_object
end
def call
save_record(@form_object)
end
private
def save_record(form_object)
facility = get_f... |
class SamplesController < ApplicationController
# GET /samples
# GET /samples.json
def index
@search = Sample.search(params[:q])
if params[:q].nil?
@samples = @search.result(:distinct => true).order('created_at DESC').paginate(:page => params[:page], :per_page => 10)
else
@samples = @search.result(:... |
# 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... |
module DiscountNetwork
class Provider < Base
def where(type:)
DiscountNetwork.get_resource(
"providers", type: type
).providers
end
def find_by_slug(slug)
DiscountNetwork.get_resource(
["providers", slug].join("/"),
).provider
end
end
end
|
# frozen_string_literal: true
require "generators/devise_authy/install_generator"
RSpec.describe DeviseAuthy::Generators::InstallGenerator, type: :generator do
destination File.expand_path("../../tmp", __FILE__)
after(:all) do
prepare_destination
end
def prepare_app
FileUtils.mkdir_p(File.join(destin... |
class CreateSessions < ActiveRecord::Migration
def change
create_table :sessions do |t|
t.integer :client_id
t.integer :user_id
t.datetime :begintime
t.datetime :endtime
t.text :notes
t.timestamps
end
add_index :sessions, :client_id
end
end
|
class CreateResourceStorageA3ParArrays < ActiveRecord::Migration[5.0]
def change
create_table :resource_storage_a3_par_arrays do |t|
t.string :name
t.string :model
t.string :serial
t.string :firmware
t.integer :space_total
t.integer :space_available
t.integer :space_used
... |
# frozen_string_literal: true
# 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... |
##
# * Implement SQL joins for Ruby Array of Arrays.
# * I'm only confident that these algorithms are correct to the extent that the
# tests inlined below pass. There are probably edge cases I'm not aware of.
# * All SQL tested on Postgres 11.3
# * All tables are represented as Array of Array
# * Aside: You can add a... |
require 'spec_helper'
describe AngellistApi::Client::ActivityFeeds do
let(:client) { AngellistApi::Client.new }
describe "#get_feed" do
it "gets 1/feed" do
options = { :some => "options" }
client.should_receive(:get).with("1/feed", options).and_return("success")
client.get_feed(options).shou... |
require 'order'
require 'validation'
require 'inventory'
require 'support/let_singleton'
describe Order do
let(:order) {
Order.new
}
let (:singleton) {
LetSingleton.instance
}
before(:example) {
singleton.sample_orders[:valid_orders].each do |item|
order.has_b... |
class CreateVersions < ActiveRecord::Migration[5.0]
def change
create_table :versions do |t|
t.integer :order_id
t.string :image_from_designer
t.string :image_from_customer
t.string :for_status
t.timestamps
end
end
end
|
# coding: utf-8
require 'spec_helper'
RSpec.describe ::Apress::Videos::Provider, type: :model do
let(:provider) { create :'apress/videos/provider' }
let(:url) { 'https://www.youtube.com/watch?v=NTmk0Pqk6hs' }
describe '.find_by_video_url' do
context 'when found' do
it { expect(described_class.find_by_... |
require 'test_helper'
class ManageAccountTest < ActionDispatch::IntegrationTest
def setup
@user = Factory(:user)
sign_in_as @user
end
def teardown
User.delete_all
end
test "User can see a link to manage his account" do
visit "/"
assert page.has_link?("Account", :href => a... |
require 'gtk3'
require './Classes/Page.rb'
require './Classes/Grille.rb'
require './Classes/Aide.rb'
require './Classes/boutonGrille.rb'
require './Classes/Chrono.rb'
require './Classes/ChronoInverse.rb'
require './Classes/boutonAide.rb'
require './Classes/boutonAideVerif.rb'
require './Classes/boutonAideHer... |
class Like < ApplicationRecord
belongs_to :user
belongs_to :status
validates :user_id, :status_id, presence: true
end
|
require 'rack/test'
require 'rspec'
require 'pry'
# require 'factory_bot'
# FactoryBot.definition_file_paths = %w{./factories ./spec/factories}
# FactoryBot.find_definitions
ENV['RACK_ENV'] = 'test'
require_relative '../app.rb'
# . is when it's a class method
# # is when it's an instance method
# mocking is for sav... |
class CommentsController < ApplicationController
def create
@department = Department.find(params[:department_id])
@comment = @department.comments.build(comment_params)
if @comment.save
render :index
else
render :error
end
end
def update
@comment = Comment.find(params[:id])
... |
class MasterParticularReport < ActiveRecord::Base
require 'locking_pessimistic_extension'
# enables block with Intention / Exclusive Lock on object
include Locking::PessimisticExtension
belongs_to :student
belongs_to :batch
belongs_to :master_fee_particular
belongs_to :fee_account
belongs_to :collectio... |
ActiveRecord::ConnectionAdapters::ConnectionHandler.class_eval do
# The only difference here is that we use klass.connection_pool_name
# instead of klass.name as the pool key
def retrieve_connection_pool(klass)
pool = @connection_pools[klass.connection_pool_name]
return pool if pool
return nil if Acti... |
class ServiceProvidersController < ApplicationController
before_action :set_service_provider, only: [:show, :edit, :update, :destroy, :dashboard, :public_view, :client_list]
before_filter :authenticate_user!, only: [:index, :show, :edit, :update, :client_list]
authorize_resource except: [:public_view]
# GET ... |
class FontHannari < Formula
head "https://github.com/google/fonts/raw/main/ofl/hannari/Hannari-Regular.ttf", verified: "github.com/google/fonts/"
desc "Hannari"
homepage "https://fonts.google.com/specimen/Hannari"
def install
(share/"fonts").install "Hannari-Regular.ttf"
end
test do
end
end
|
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module MobileCenterApi
module Models
#
# a stacktrace in a processed and prettyfied way
#
class Stacktrace
# @return [String]... |
class TitlesBelongToDocsAndAudiences < ActiveRecord::Migration
def self.up
add_column :titles, :doc_id, :integer
add_column :titles, :audience_id, :integer
end
def self.down
remove_column :titles, :doc_id
remove_column :titles, :audience_id
end
end
|
class FontNotoSansSyriac < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/notosanssyriac"
desc "Noto Sans Syriac"
homepage "https://fonts.google.com/specimen/Noto+Sans+Syriac"
def install
(share/"fonts").install "NotoSansSyriac-Black.... |
Pod::Spec.new do |s|
s.name = 'FakeTouch'
s.version = '1.0.0'
s.license = 'MIT'
s.summary = 'FakeTouch is a framework that simulates iOS touch events.'
s.homepage = 'https://github.com/AlfredCN/FakeTouch'
s.author = "Watanabe Toshinori"
s.source = { :git => 'https://github.com/AlfredCN/FakeTouch.git', :ta... |
json.array!(@project_research_fields) do |project_research_field|
json.extract! project_research_field, :id
json.url project_research_field_url(project_research_field, format: :json)
end
|
class OrderLineItemsController < ApplicationController
layout "order_line_item"
#load_and_authorize_resource
def index
@order_line_items = OrderLineItem.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @order_line_items }
end
end
def show
@order... |
class Animal
def speak
"Hello!"
end
end
class GoodDog < Animal
attr_accessor :name
def initialize(n)
self.name = n
end
def speak
"#{self.name} says arf!"
end
end
class Cat < Animal
def speak
super + " from Cat class!"
end
end
snowball = GoodDog.new("Sparkles")
meowsly = Cat.new
pu... |
require 'minitest/autorun'
require 'minitest/pride'
require 'pry'
require_relative 'products'
class ProductsTest < Minitest::Test
def test_Products_exists
assert Products
end
def test_returns_products_of_other_integers
products = Products.new
nums = [1, 2, 3, 4]
assert_equal [24, 12, 8, 6], pro... |
# frozen_string_literal: true
module Zendesk
class Text
class << self
def ticket_link(id)
"<#{Zendesk::Client::HOST}agent/tickets/#{id}|#{I18n.t('ticket')} ##{id}>"
end
def ticket_closed(id)
"#{ticket_link(id)} #{I18n.t('on_this_thread_already_closed')}. #{I18n.t('do_on_closed_... |
module Naf
class MachineRunnerInvocationsController < Naf::ApplicationController
before_filter :set_rows_per_page
def index
respond_to do |format|
format.html
format.json do
set_page
@total_records = ::Naf::MachineRunnerInvocation.count(:all)
@rows = ::Lo... |
require_relative 'lib/sms_service'
interrupted = false
# Trap ^C
Signal.trap('INT') do
puts "\n"
puts 'Shutting down...'
interrupted = true
end
# Trap `Kill`
Signal.trap('TERM') do
puts "\n"
puts 'Shutting down...'
interrupted = true
end
# Setup LEDs
led1 = PiPiper::Pin.new(pin: 16, direction: :out)
led... |
module Cocoaout
class << self
attr_accessor :config
attr_accessor :xcode_build
attr_accessor :temp_dir
attr_accessor :dist_dir
attr_accessor :build_dir
end
class Configuration
attr_accessor :app_name,
:sdk,
:project,
:dmg_backgroun... |
module Fog
module DNS
class PowerDNS
class Real
# Get details of all powerdns servers
#
# ==== Parameters
#
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * server<~Array>:
# * 'type': <~String>,... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cloud_capacitor/version'
Gem::Specification.new do |spec|
spec.name = "cloud_capacitor"
spec.version = CloudCapacitor::VERSION
spec.authors = ["Marcelo Goncalves"]
sp... |
class CreateRestrictions < ActiveRecord::Migration
def change
create_table :restrictions do |t|
t.decimal :threshold
t.references :feature
t.timestamps
end
add_index :features, :feature_id
end
end
|
require 'project_favicon'
Redmine::Plugin.register :redmine_project_favicon do
name 'Redmine Project Favicon plugin'
author 'OZAWA Yasuhiro'
description 'Setting project favicon'
version '0.0.1'
url 'https://github.com/ameya86/redmine_project_favicon'
author_url 'https://github.com/ameya86'
# ใใฉใฐใคใณใฎ่จญๅฎ
... |
class CreateArticle < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :title
t.date :date
t.string :second_title
t.string :main_image
t.string :second_image
t.text :first_description
t.text :second_description
t.text :photo_description
... |
class FinanceInflowsController < ApplicationController
# GET /finance_inflows
# GET /finance_inflows.json
def index
@finance_inflows = FinanceInflow.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @finance_inflows }
end
end
# GET /finance_inflows/1
... |
module Higan
class Remote
attr_accessor :host, :user, :password, :mode, :base_dir
def initialize(**params)
params.each_pair do |k, v|
self.send("#{k}=", v)
end
end
def remote_path(path)
base_dir + path
end
def to_h
{
host: host,
user: user,
... |
class Api::UsersController < Api::BaseController
before_action :find_user, only: %w[show]
def show
render_jsonapi_response(@user)
end
def update
if current_user.update(user_params)
current_user.save
render json: current_user
else
render json: current_user.errors.full_messages, s... |
class Asset < ActiveRecord::Base
require "iconv"
attr_accessible :media_content_type, :media_file_name, :media_file_size, :media_updated_at, :name, :media
belongs_to :assetable, :polymorphic => true
has_attached_file :media,
:styles => { :medium => "300x300>", :thumb => "100x100>" }
befo... |
class RenameColumnsRecipeIngredientsPostIdToRecipeId < ActiveRecord::Migration
def change
rename_column :recipe_ingredients, :post_id, :recipe_id
end
end
|
class CreateLocations < ActiveRecord::Migration
def change
create_table :locations do |t|
t.decimal :lng, precision: 9, scale: 6
t.decimal :lat, precision: 8, scale: 6
t.string :ssid
t.string :bssid
t.string :mac
t.integer :strength
t.string :tech
t.string :freq
... |
module WebiniusCms
class User < ApplicationRecord
has_secure_password
validates_presence_of :name, :username
validates :password, :presence => true, :on => :create
validates :password_confirmation, :presence => true, :on => :create
end
end
|
require 'spec_helper'
describe "events/new" do
before(:each) do
theStub = stub_model(Event,
:name => "MyString",
:home_team => nil,
:visiting_team => nil,
:location => nil
).as_new_record
theStub.build_location
assign(:event, theStub)
end
it "renders new event form" ... |
class ReportsController < ApplicationController
before_filter :only_admin, only: [:index]
layout 'application_new'
def create
@report = Report.new
@report.user_id = current_user.id
@report.post_id = params[:post_id]
if @report.save
redirect_to :back
end
end
def index
@report... |
require 'multi_json'
module VCR
class Cassette
class Serializers
module JSON
extend self
def file_extension
"json"
end
def serialize(hash)
MultiJson.encode(hash)
end
def deserialize(string)
MultiJson.decode(string)
end... |
require 'data_mapper' unless defined?DataMapper
module BookingDataSystem
#
# This represents a booking extra
#
class BookingExtra
include DataMapper::Resource
storage_names[:default] = 'bookds_bookings_extras'
property :id, Serial, :field => 'id'
property :extra_id, Str... |
require 'test_helper'
I18n.config.backend.store_translations(:en,
{:activity => {:test => '%{one} %{two}'}}
)
describe 'PublicActivity::Activity Rendering' do
describe '#text' do
subject { PublicActivity::Activity.new(:key => 'activity.test', :parameters => {:one => 1}) }
specify '#text uses translations... |
require "spec_helper"
describe WordLadder::Dictionary do
let!(:dictionary) { WordLadder::Dictionary.new }
describe :exists? do
context "word exists" do
let(:words) do
["can", "ANd", "Mississippi"]
end
it "returns true" do
words.each do |w|
expect(dictionary.exists?... |
class Product < ActiveRecord::Base
has_many :pictures, as: :imageable
belongs_to :brand
has_many :product_category
has_many :category, :through => :product_category
end
|
json.result do
json.extract! @case, :id, :status
end
json.comments do
json.array! @case.comments.each do |comment|
json.id comment.id
json.comment comment.comment
end
end
if @case.present?
json.status 200
else
json.status 400
end |
require File.dirname(__FILE__) + '/../../spec_helper'
describe 'S3.put_request_payment' do
before(:all) do
@s3 = Fog::AWS::S3.gen
@s3.put_bucket('fogputrequestpayment')
end
after(:all) do
@s3.delete_bucket('fogputrequestpayment')
end
it 'should return proper attributes' do
actual = @s3.put... |
class AddThumbPathToNotif < ActiveRecord::Migration
def change
add_column :notifications, :thumb_path, :string
end
end
|
#!/usr/bin/env ruby
#
# This script implements the "hv" application. Type "hv FILE" to
# view FILE as HTML.
#
# This application is used for testing the HTML widget. It can
# also server as an example of how to use the HTML widget.
#
require 'tk'
require 'tkextlib/tkHTML'
root = TkRoot.new(:title=>'HTML File Viewer... |
class PhoneNumber < ActiveRecord::Base
include ActiveModel::Validations
extend Enumerize
# Associations
#----------------------------------------------------------------------------
belongs_to :phonable, :polymorphic => true
# Attributes
#----------------------------------------------------------------... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
has_many :expenses
has_many :periodic_expenses
validates ... |
class CreateTweets < ActiveRecord::Migration
def change
create_table :tweets do |t|
t.string :tweet_id
t.string :tweet_time
t.string :twitter_user
t.string :twitter_user_id
t.string :tweet_body
t.string :latitudes
t.string :longitudes
t.string :query
t.string ... |
# == Schema Information
#
# Table name: requests
#
# id :integer not null, primary key
# sender_id :integer
# receiver_id :integer
# category :string(255)
# content :string(255)
# created_at :datetime
# updated_at :datetime
# group :string(255)
#
class Request < ActiveRecord:... |
class VehiclesController < ApplicationController
helper_method :sort_column, :sort_direction
def index
@vehicles = Vehicle.all
if params[:search]
@vehicles = Vehicle.search(params[:search]).order(sort_column + " " + sort_direction)
else
@vehicles = Vehicle.all.order(sort_column + " " + so... |
class User
include Lotus::Entity
self.attributes = :email, :username
def auth_for(provider)
AuthRepository.by_user_and_provider(id, provider.to_s)
end
end
|
class CreateOwnershipRecords < ActiveRecord::Migration
def change
create_table :ownership_records do |t|
t.integer :year_acquired
t.integer :year_relinquished
t.integer :purchase_price
t.timestamps null: false
end
end
end
|
require 'chef'
require 'chef/knife/core/generic_presenter'
module Lita
module Handlers
class Enhance < Handler
# This class is responsible for indexing Chef servers to extract
# enhanceable data to populate the enhance indices.
class ChefIndexer
attr_reader :last_refreshed
attr... |
source 'https://rubygems.org'
gem 'rake'
gem 'rails', '3.2.22'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'blacklight', '3.1.2'
gem 'blacklight-sitemap'
gem 'devise', "~> 2.0"
gem 'rest-client'
gem 'simple-daemon'
gem "will_paginate", '~> 3.0.5'
gem 'json'
gem 'active... |
require 'erb'
require 'ostruct'
class ErbalT < OpenStruct
def render(template)
ERB.new(template).result(binding)
end
end
class Template
attr_accessor :template_name
attr_accessor :view_path
attr_accessor :vars
def initialize(tpl)
@vars = {
'bar' => 'foo'
}
@view_path = "views/"
@template_nam... |
require_relative '../helper'
require 'termistat'
class Included
include Termistat
end
class TestTermistat < MiniTest::Unit::TestCase
def setup
Termistat.config = nil
@included = Included.new
end
def test_status_bar_method
assert @included.respond_to?(:status_bar)
end
def test_ncurses_initial... |
class SectionsController < ApplicationController
before_action :fetch_chapter
before_action :fetch_section, only: [:show, :edit, :update, :destroy]
def index
end
def new
@section = @chapter.sections.new
end
def create
@section = @chapter.sections.new(section_params)
if @section.sa... |
require 'spec_helper'
describe Event, 'validations' do
context 'when valid data' do
let!(:user) { create(:user, :paul) }
let!(:other_user) { create(:user, :billy) }
let!(:event) do
create(
:event,
:tasafoconf,
users: [user, other_user],
owner: user
)
end
... |
class ProjectContribution < ApplicationRecord
belongs_to :character, inverse_of: :project_contributions
belongs_to :project, ->{ includes(:leader) }, inverse_of: :project_contributions
before_create :invest_talent
accepts_nested_attributes_for :project, allow_destroy: true
def invest_talent
self.charac... |
json.array!(@characters) do |character|
json.extract! character, :id, :name, :alias, :description, :novel_id
json.url character_url(character, format: :json)
end
|
require 'test_helper'
require 'pry'
class UsersSignupTest < ActionDispatch::IntegrationTest
test 'invalid signup information' do
get signup_path
assert_no_difference 'User.count' do
post users_path, params: { user: { name: '',
email: 'user@invalid',
... |
class API::V1::Users::EventsController < ApplicationController
def index
render json: set_user.events.all
end
def create
if set_user.events << Event.create(event_params)
head :ok
else
render json: { errors: @user.errors }, status: 422
end
end
private
def set_user
@user ||=... |
FactoryGirl.define do
sequence :category do |n|
cats = Category.all
cats[n % Category.count]
end
sequence :name do |t|
"asd#{t}"
end
sequence :title do |t|
"title#{t}"
end
factory :tag do
name
end
factory :article do
title
category
teaser """<p>Lorem ipsum dolor si... |
FactoryBot.define do
factory :pixel do
name { Faker::Name.unique.name }
conversions { (1..1500).to_a.sample.to_i }
association :provider, factory: :provider
end
end
|
class PaymentNoty < ApplicationRecord
belongs_to :cart
serialize :params
after_create :mark_cart_as_purchased, :notif, :balance
private
def mark_cart_as_purchased
if status == "Completed"
cart.update_attribute(:purchased_at, Time.now)
cart.update_attribute(:status, "success")
end
end
... |
class NutritionalsController < ApplicationController
# GET /nutritionals
# GET /nutritionals.xml
def index
if params[:search]
@nutritionals = Nutritional.search params[:search],
:include => :foodvendor, :order => "codenum ASC" , :page => params[:page], :per_page => 100
@nutritionals.sort!
... |
class AddTopicIdToEnquetes < ActiveRecord::Migration[5.0]
def change
add_reference :enquetes, :topic, null: false, foreign_key: true
end
end
|
set :application, "pse-tool"
set :user, "ubuntu"
set :domain, "freetier2"
set :deploy_to, "/var/www/#{application}"
set :app_path, "app"
set :repository, "git@github.com:gapzroble/pse-tool.git"
set :branch, "master"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `p... |
module Fog
module Parsers
module TerremarkEcloud
module Compute
class InstantiateVmTemplate < Fog::Parsers::Base
def start_element(name, attrs = [])
case name
when 'VApp'
@response['name'] = attr_value('name', attrs)
@response['uri'] ... |
require 'test/unit'
require 'minitest/reporters'
MiniTest::Reporters.use!
class Proc
def call_handling(an_exception_class,&handler)
return_closure = proc { |an_object|
return an_object }
ExceptionHandler.install_new_handler_for an_exception_class,handler,return_closure
begin
call
ensure... |
require "asciidoctor"
require "asciidoctor/standoc/converter"
require "fileutils"
require_relative "./front_id.rb"
module Asciidoctor
module NIST
# A {Converter} implementation that generates RSD output, and a document
# schema encapsulation of the document for validation
class Converter < Standoc::Conv... |
class RemoveRubygemsDownloads < ActiveRecord::Migration
def change
remove_column :rubygems, :downloads, :integer
end
end
|
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
helper_method :signed_in?, :current_user
private
def current_user
@current_user ||= User.find(session[:user_id]) if ... |
require_relative 'test_helper'
class MultipleCasesTests < SlightishTest
suite('adjacent commands', %[
$ echo 2
$ echo 3
]).should do |s|
assert_equal(2, s.test_cases.length)
assert_case(s.test_cases[0], 'echo 2', [1, 1])
assert_case(s.test_cases[1], 'echo 3', [2, 2])
end
suite('command aft... |
# Copyright (C) 2007 Teskal
class ApplicationController < ActionController::Base
before_filter :check_if_login_required, :set_localization
filter_parameter_logging :password
# around_filter :set_timezone
def logged_in_user=(user)
@logged_in_user = user
session[:user_id] = (user ? user.id : ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.