text
stringlengths
10
2.61M
# encoding: UTF-8 # # Cookbook Name:: jenkins_utils # Recipe:: deps # # This recipe adds the required dependencies to use the LWRPs provided in this # cookbook to a Jenkins CI server. Include it in the run list of your Jenkins # nodes. # # Author:: David Schlenk <david.schlenk@spanlink.com> # Copyright (C) 2014 Spanlin...
require "./lib/minivan" describe Minivan do let(:minivan) { Minivan.new("Fiat", "minivan", "435BL") } describe "#to_s" do it "returns string with minivan's dates" do expect(minivan.to_s).to eq("The minivan: Fiat - minivan - 435BL") end end end
# frozen_string_literal: true require "logger" require "traject" require "json" require "traject/nokogiri_reader" require "traject_plus" require "traject_plus/macros" require "arclight/level_label" require "arclight/normalized_date" require "arclight/normalized_title" require "active_model/conversion" ## Needed for Ar...
class Confirmation < ActionMailer::Base default :from => "sathish.subramanian@raisfactory.org" def send_mail(u,password,user) @pass=password @user=user @email=u mail(:to=>"<#{u}>",:subject=>"your account have been activated successfully.") end end
# frozen_string_literal: true require 'test_helper' module ShopifyApp class SessionRepositoryTest < ActiveSupport::TestCase teardown do SessionRepository.shop_storage = nil SessionRepository.user_storage = nil end test ".user_storage= does not raise ArgumentError if input is nil" do as...
class Librarian < Account def initialize username, bar_code_id super username, bar_code_id end def add_book_item title, authors, language, rack_id book_item = BookItemModel.new book_item.title = title book_item.authors = authors book_item.language = language ...
class AddDocIdToReviews < ActiveRecord::Migration def change add_column :reviews, :doc_id, :integer end end
class LastPost < ActiveRecord::Base self.table_name = 'last_posts' belongs_to :user has_many :posts def self.for_user(user) where(user_id: user.id).order(created_at: :desc) end end
# class Person # attr_accessor :name, :phone_number # end class Person attr_writer :name, :phone_number attr_reader :name end person1 = Person.new person1.name = 'Jessica' person1.phone_number = '0123456789' puts person1.name
require 'spec_helper' describe Fn::Salesforce::Rollback do context '#new' do let(:first_operation) { double("Operation") } let(:second_operation) { double("Operation") } let(:plan) { [first_operation, second_operation] } before { allow(Fn::Salesforce::UndoFactory).to receive(:coerce) { |o| o } } ...
class CreatePilotageCharges < ActiveRecord::Migration def self.up create_table :pilotage_charges do |t| t.integer :diapason_id t.integer :gt_from t.integer :gt_to t.decimal :tarif t.timestamps end end def self.down drop_table :pilotage_charges end end
require 'byebug' require_relative 'piece' class Pawn < Piece def initialize(board, color, position, piece_type) super @color = color @direction = -1 if color == :white @direction = 1 if color == :black @value = 1 end def specific_legal_move?(to_position) # p @position # p to_positio...
require 'fog/core/collection' require 'fog/powerdns/models/dns/zone' module Fog module DNS class PowerDNS class Zones < Fog::Collection model Fog::DNS::PowerDNS::Zone # attribute :zone, :aliases => 'name' def all clear data = service.list_zones.body ...
json.array!(@flights) do |flight| json.extract! flight, :id, :airlineCode, :gate, :number, :city, :adi, :scheduled, :terminal, :delay, :created_at, :updated_at json.url flight_url(flight, format: :json) end
require 'spec_helper' describe User do before(:each) do @attr = { :name => "Example User", :virtualPW => "foobar"} end describe "password encryption" do before(:each) do @user = User.create!(@attr) end describe "has_password? method" do it "should be true if the passwor...
namespace :email do desc "gets the top 2 selling products" task :top_product => :environment do query = "SELECT pd.name, COUNT(quantity) AS quantity FROM orders o INNER JOIN payments p ON p.order_id = o.id LEFT JOIN products pd ON pd.id = o.product_id GROUP BY pd.name ...
class DocumentsController < ApplicationController before_filter :find_document, :only => [:show, :condensed, :edit, :update, :destroy] # GET /documents # GET /documents.xml def index @documents = Document.find :all respond_to do |wants| wants.html # index.html.erb wants.xml { render :xml ...
class UsersController < ApplicationController skip_before_action :authenticate_user!, :only => [:show], if: :json_request? def show @user = User.find(params[:id]) render json: @user end private def json_request? request.format.symbol == :json end end
module Manufacturer attr_accessor :manufacturer private def validate_manufacturer raise "Недопустимый производитель" if @manufacturer != nil && !@manufacturer.class.ancestors.include?(String) # nil допустим (производитель неопределен) raise "Название производителя не может быть пустым (если производи...
class User < ApplicationRecord enum role: [:user, :vip, :admin] enum default_currency: ['€', '$', '£'] has_many :entries, dependent: :destroy validates_presence_of :name, :default_currency after_initialize :set_default_role, :if => :new_record? # Include default devise modules. Others available are: #...
# package 'wine' exe_url = "https://d13itkw33a7sus.cloudfront.net/dist/1P/win4/1Password-4.6.2.626.exe" exe_sha1 = "1f7cd4115b1d0908765d97289e0d31a77dbe8948" dest_path = "#{ENV['HOME']}/.wine/drive_c/Program Files (x86)/1Password 4/1Password.exe" execute "curl -fSL -o /tmp/1Password.exe #{exe_url}" do user node[...
# encoding: utf-8 $: << 'RspecTests/Generated/dictionary' $: << 'RspecTests' require 'base64' require 'generated/body_dictionary' require 'helper' include DictionaryModule include DictionaryModule::Models describe Dictionary do before(:all) do @base_url = ENV['StubServerURI'] dummyToken = ...
require 'card' class Deck attr_reader :cards # Fills the deck with cards in a random order. def initialize @cards = [] add_deck!.shuffle! end # Shuffles 52 more cards into the current deck of cards. def add_deck! Card::SUITS.each do |suit| Card::VALUES.each do |value| # Inserts ...
class Kdevplatform < Formula desc "KDevelop Platform" homepage "http://kdevelop.org" stable do url "https://download.kde.org/stable/kdevelop/5.1.1/src/kdevplatform-5.1.1.tar.xz" sha256 "3159440512b1373c1a4b35f401ba1f81217de9578372b45137af141eeda6e726" depends_on "qt" => ["with-qtwebkit"] end hea...
# Gets the file name the user wants to use for this script filename = ARGV.first # Displays strings, letting user know what will happen # The .gets I think is to pause the program, so the user can # input return for continue or ctrl-c to back out puts "We're going to erase #{filename}" puts "If you don't want t...
class CreateTasks < ActiveRecord::Migration[5.1] def change create_table :tasks do |t| t.string :title t.string :title_icon, :default => "https://cdn.onlinewebfonts.com/svg/img_167476.png" t.text :desc t.integer :points t.string :images t.date :duration t.string :statu...
module Justified SKIP_STR = ' ... skipped %s lines' CAUSED_STR = 'caused by:' def self.version @version ||= Gem::Version.new File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')) end module Error def initialize(message = nil, cause = $!) super(message) set_cause cause ...
# frozen_string_literal: true class SessionsController < ApplicationController def new; end def create user = User.find_by(email: params[:email].downcase) if user&&user.authenticate(params[:password]) if user.activated? log_in user params[:remember_me] == '1' ? remember(user) : forge...
require_dependency 'projects_helper' module ProjectFavicon module ProjectsHelperPatch def self.included(base) # :nodoc: base.send(:include, InstanceMethods) # obj.method end module InstanceMethods # obj.method # プロジェクトの添付ファイルの内、画像ファイルを取得 def project_image_attachments return [] ...
class JSONReader def read_file(path, presenter) file_for_translation = File.read(path) @reader_errors = [] parse_as_json(file_for_translation) if @reader_errors.empty? presenter.display_success( 'Successfully read JSON file. Now ready for translation' ) else presenter.dis...
class LocationImage < ActiveRecord::Base belongs_to :location acts_as_list :scope => :location scope :asc, order('position ASC') has_attached_file :image, :url => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/paperclip/locations/:location_id/:id/:style/:basename.:extension", :path => ":rails_r...
# # Usage: # Color = Enum.new(:Red, :Green, :Blue) # Color.is_a?(Enum) # => true # Color::Red.inspect # => "Color::Red" # Color::Green.is_a?(Color) # => true # Color::Green.is_a?(Enum::Member) # => true # Color::Green.index # => 1 # Color::Blue.enum # => Color # values = [[255, 0, 0], [0, 255, 0], [0, 0, 255]] # values...
require File.dirname(__FILE__) + "/../../spec_helper" describe Instructors::ClientVersionsController do let(:current_user) { Factory.stub(:instructor) } let(:mock_client_version) { mock_model(ClientVersion) } before { controller.stub(:current_user).and_return(current_user) } describe "GET index" do b...
# frozen_string_literal: true module J8 class BiPredicate include J8::Common def test(o1, o2) @callable.call(o1, o2) end def negate J8::BiPredicate.new(->(o1, o2) { !test(o1, o2) }) end def and(other = nil, &block) callable = from_callable(other, block) J8::BiPredi...
# # Be sure to run `pod lib lint ALFoundation.podspec' to ensure this is a # valid spec and remove all comments before submitting the spec. # # Any lines starting with a # are optional, but encouraged # # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name ...
require 'gtk3' require './Interface/fPlayA.rb' #====== Fenetre de saison du jeu class FSaison < Page #Initialise la page # @param monApp //l'application # @param header //le titre de la page # @param anciennePage //Le lien de la dernière page # @param unJoueur //le joueur concerné # @param uneSaison /...
class CreateWebSearchResults < ActiveRecord::Migration def change create_table :web_search_results do |t| t.string :query t.string :position t.string :domain t.string :link t.string :title t.string :snippet t.timestamps end add_index :web_search_results, [:domai...
module Hadupils::Commands module Options # NOTE: Only a single option per command (known limitation for now) module Directory def perform_directory? %w(-d --directory).include? params[0] end end module DryRun def perform_dry_run? %w(-n --dry-run).include? params[0] ...
# == Schema Information # # Table name: imports # # id :integer not null # api_key :string # resource_type :string # mapping :text # record_count :integer # success_count :integer # error_count :integer # created_at ...
class NightmaresController < ApplicationController def index @nightmare = Nightmare.order("RANDOM()").first end def new @nightmare = Nightmare.new end def create Nightmare.create(night_params) redirect_to root_path end private def night_params params.require(:nightmare).permit(:s...
class AddAttachmentsArtistPhotoToNewsletter < ActiveRecord::Migration def self.up add_column :newsletters, :artist_photo_file_name, :string add_column :newsletters, :artist_photo_content_type, :string add_column :newsletters, :artist_photo_file_size, :integer end def self.down remove_column :news...
module Sherpa::Convertible attr_accessor :external_id, :bc_attrs alias :attrs :bc_attrs class << def type @type = "MUST BE SET" end end def initialize(bc_obj) @bc_attrs = bc_obj.attributes.inject({}) do |hash, (key, value)| hash[key.gsub('-', '_').to_sym] = value hash end ...
# deal metric would be cooler here class DealMetric < ActiveRecord::Base belongs_to :deal belongs_to :reporting_month # this is just a timespan # #DEAL_STATES = %w(Running, Renewed, Completed) # #belongs_to :client, :class_name => 'Person' # # ## relation to map different types of deals. bsp: ## ...
class Candidato < ActiveRecord::Base has_many :works has_many :estudios belongs_to :organismo end
module SupplyTeachers class Journey::FTACalculatorContractEnd < GenericJourney include Steppable attribute :contract_start_date_day attribute :contract_start_date_month attribute :contract_start_date_year attribute :contract_end_date_day attribute :contract_end_date_month attribute :contr...
class CertificateTemplate < ActiveRecord::Base xss_terminate named_scope :student_templates, {:conditions => {:user_type => 1}} named_scope :employee_templates, {:conditions => {:user_type => 2}} named_scope :parent_templates, {:conditions => {:user_type => 3}} belongs_to :base_template has_many :generate...
class AddBubblesCountToIdeas < ActiveRecord::Migration def self.up add_column :ideas, :bubbles_count, :integer end def self.down remove_column :ideas, :bubbles_count end end
require 'active_record' require './lib/task' require './lib/list' database_configurations = YAML::load(File.open('./db/config.yml')) development_configuration = database_configurations['development'] ActiveRecord::Base.establish_connection(development_configuration) def welcome puts "Welcome to the To Do list!" l...
class Paginator PAGE_NUM_KEY = 'page[number]' PER_PAGE_KEY = 'page[size]' PAGER_SEQUENCES = [:first, :prev, :next, :last].freeze attr_reader :collection def initialize(collection, controller) @collection = collection @controller = controller end def pager_urls (PAGER_SEQUENCES & page_links...
module DataAbstraction::Unit class DurationValue < Generic STANDARD_UNIT = "second" UNITS = [ [ "milli_second", "ms", "milli_second", "milli_seconds", "msec" ], [ "second", "s", "second", "seconds", "sec" ], [ "minute", "m", "minute", "minites", "min" ], ...
class Inventory < ApplicationRecord validates_presence_of :item_dec validates_uniqueness_of :item_dec, message: "has already been taken ", if: :uniqe_item_dec validates_format_of :incident_rep, :with => /\A[0-9][0-9_]*\Z/, message: "Please enter numbers only", if: :is_non_seriral? def is_non_seriral? bool = fals...
class ConfigOption < ActiveRecord::Base validates_presence_of :key end
class KigyoInfo < ActiveRecord::Base belongs_to :kigyo_daicho validates_presence_of :kigyo_number validates_numericality_of :kigyo_number, :jugyoinsu, :kigyo_daicho_id end
class UsersController < ApplicationController def new @states = State.all end def create form = params[:user] if form[:password] == form[:password_confirmation] state = State.find(form[:state_id]) user = User.new(user_params) user.state = state user.save flash[:msg] = "S...
class Income < ActiveRecord::Base belongs_to :property has_many :income_items, dependent: :destroy accepts_nested_attributes_for :income_items, allow_destroy: true def total income_items.sum(:amount) end end
=begin Récupère le contenu d'un fichier :path Le path du fichier :options Les options et notamment 'as', le format ('json' ou 'brut') @return le contenu dans :file_content Ce contenu est mis à "FICHIER <path> INTROUVABLE" si le fichier n'existe pas. =end require 'json' path...
class HomeGalleriesController < ApplicationController def index @categories = Category.all.where(is_active: true).order('created_at ASC') @galleries = HomeGallery.where(is_active: true, is_home_img: false) end end
require 'rails_helper' describe Section do it { should belong_to(:category) } it { should validate_presence_of(:title) } it { should validate_presence_of(:description) } it { should validate_length_of(:description).is_at_most(150).with_message("De beschrijving mag maximum 150 karakters lang zijn") } end
require 'set' module Rely # Defines a macro to allow object dependencies to be specified at the class # level with a block defining a default value. # # Based on attr_defaultable. module Dependencies # Ensure dependencies from the superclass are inherited by the subclass. def inherited(subclass) ...
# == Schema Information # # Table name: countries # # id :integer not null, primary key # created_at :datetime not null # updated_at :datetime not null # name :string # iso :string # bbox :string default([]), is an Array # short_iso :st...
# -*- encoding : utf-8 -*- dir = File.dirname(__FILE__) $LOAD_PATH.unshift dir + '/../lib' $LOAD_PATH.unshift dir STDERR.puts("Running specs using ruby version #{RUBY_VERSION}") require 'simplecov' SimpleCov.start require 'rspec' require 'webmock/rspec' require 'itrp/export/monitor' # Requires supporting ruby file...
require "csv" class ReportGenerator def export(valid_data: , invalid_data: ) write_to_csv(valid_data: valid_data) write_to_txt(invalid_data: invalid_data) end def write_to_csv(valid_data: ) CSV.open("output.csv", "w", { headers: valid_data.first.keys }) do |csv| valid_data.each do |row_hash| ...
require "spec_helper" describe QBIntegration::Service::Account do let(:config) { Factories.config } subject do described_class.new config end it "finds account by name" do VCR.use_cassette("account/find_by_name", match_requests_on: [:method, :body]) do account = subject.find_by_name "Inventory ...
require 'spec_helper' describe "Implementation Configuration Modification" do describe "self.assign_supp_plan_multi(params)", :vcr do it "Assigns multiple supplemental plans to a specified account." do params = {"acct_no" => 1, "supp_plan_no" => 1} response = api.assign_supp_plan_multi params res...
class Api::UsersController < ApplicationController before_action only: :update do |c| c.prevent_illegal_changes params[:id] end before_action :redirect_unless_logged_in def index @users = User.order(:id) @follows_hash = current_user.out_follows_hash render :index end def show @user = U...
package "postgresql-server" package "postgresql-jdbc" package "postgresql-jdbc-javadoc" execute "setup postgresql" do command "postgresql-setup initdb" not_if { ::File.exists?('/root/ambari-setup/postgresql-configured') } end file '/root/ambari-setup/postgresql-configured' service "postgresql" do action [:enab...
class AccountSnapshotCluster include Mongoid::Document include Mongoid::Timestamps belongs_to :account belongs_to :snapshot_cluster index({ account: 1 }) index({ snapshot_cluster: 1 }) index({ account: 1, snapshot_cluster: 1 }, { :unique => true }) # creates and alias for the cluster name def self....
require 'brew_sparkling/action/install/base' require 'brew_sparkling/action/install/fetch' require 'brew_sparkling/action/install/unpack' require 'brew_sparkling/action/install/patch' require 'brew_sparkling/action/install/build' require 'brew_sparkling/action/install/install_app' require 'brew_sparkling/action/install...
class CreateSeniorProject < ActiveRecord::Migration def change create_table :senior_projects do |t| t.integer :student_id t.string :status t.string :end_term t.string :cert_term_projected t.string :cert_term_certified t.string :ceremony_term t.datetime :grad_app_submitted_date ...
class Rotativo < ActiveRecord::Base validates_uniqueness_of :data validates_presence_of :valor_rotativo def valor_do_dia if valor_mensalista.nil? return valor_rotativo else return valor_rotativo + valor_mensalista end end def valor_medio if numero_de_carros==0 return...
require 'octokit' require 'sinatra_auth_github' require 'dotenv' require 'open3' require 'json' require 'securerandom' require 'fileutils' require 'rack/coffee' Dotenv.load class GitHubUploader class App < Sinatra::Base enable :sessions set :github_options, { :scopes => "repo", :secret =...
module Anonymized class DefaultPostgresqlFunctionDefinitions class << self def definitions(function_schema) <<-SQL CREATE OR REPLACE FUNCTION #{function_schema}.anonymized_string(length INTEGER, alphanumeric BOOL) RETURNS TEXT AS $$ DECLARE cha...
require './lib/car' class Owner attr_reader :name, :occupation, :cars, :make, :model, :color, :year, :age def initialize(name, occupation) @name = name @occupation = occupation @cars = [] end def buy(the_car) car_hash = { :make => the_car.split[2], :model => the_car.split[3], ...
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Utils autoload :CodePoints, 'twitter_cldr/utils/code_points' autoload :FileSystemTrie, 'twitter_cldr/utils/file_system_trie' autoload :RangeSet, 'twitter...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'payment-integration-redecard/version' Gem::Specification.new do |spec| spec.name = "payment-integration-redecard" spec.version = PaymentIntegrationRedecard::VERSION spec.auth...
require 'capybara/dsl' class BBC_Site # constants HOMEPAGE_URL = 'http://www.bbc.co.uk' SIGN_IN_LINK_ID = '#idcta-username' # for ID attribute # REGISTER_LINK = 'Register now' # OR REGISTER_LINK_2 = '.link--primary' # for class attribute THIRTEEN_OR_OVER_LINK = '13 or over' # for text content BIRTHDAY_D...
require "rails_helper" RSpec.describe TimeSpansHelper do describe "#duration_text" do context "some hours and some minutes" do it "returns text correctly formatted" do expect(duration_text(135)).to eq("2hr 15mn") end end context "1 hour" do it "returns text correctly formatted"...
# frozen_string_literal: true module Pmd VERSION = '1.0.5' end
# implement a spreadsheet class # With two functions # GetValue() and SetValue() # The inputs are a key, like A15 and a value for get # And set is just a key # test cases: # invalid location: A0, must start at A1 # the highest letter to 'ordinal' permitted is 25 # set_value # Example: A2 # x, horizontal row, 2 - 1 ...
module OMF::Web::Rack class RackException < Exception attr_reader :reply def initialize(err_code, reason) super reason body = {:exception => { :code => err_code, :reason => reason }} @reply = [err_code, {"Content-Type" => 'text/json'}, body.to_json] end end ...
# frozen_string_literal: true # Author: Usman Ahmad # A class for easy handling of Command Line Interfaces class CLIOperations QUIT_CHARACTER = '!' DEF_INT_PROMPT = 'Please enter a value' def self.general_secure_input(prompt, invalid_input_msg, validation_lambda) prompt += " {#{QUIT_CHARACTER} to quit}: " ...
class AddColumnTitleToPeopleEmploymentStatuses < ActiveRecord::Migration def change add_column :people_employment_statuses, :title, :string end end
class Document < ApplicationRecord include Impressionist::IsImpressionable is_impressionable counter_cache: :true, column_name: :total_view, unique: :request_hash belongs_to :category belongs_to :language mount_uploader :source_file, SourceFileUploader, dependent: :destroy mount_uploader :image, ImageUpload...
module NotionOrbit module NotionObjects module BlockTypes class BulletedListItem < Block def to_markdown '- ' + super end def indent_children? true end end end end end
class User < ApplicationRecord has_secure_password has_many :ed_pursuits has_many :notes, through: :ed_pursuits has_many :ed_types, through: :ed_pursuits has_many :providers, through: :ed_pursuits has_many :goals validates :email, uniqueness: true, presence: true validates :password_dige...
class CreateTaoAgeTaoProducts < ActiveRecord::Migration def change create_table :tao_ages_tao_products do |t| t.integer :tao_age_id t.integer :tao_product_id t.timestamps end add_index :tao_ages_tao_products, [:tao_age_id, :tao_product_id] end end
json.array!(@place_orders) do |place_order| json.extract! place_order, :id, :group_id, :first, :second, :third json.url place_order_url(place_order, format: :json) end
require_relative '../spec_helper' describe Praxis::View do let(:person) { Person.example(['person']) } let(:address) { person.address } let(:view) do Praxis::View.new(:tiny, Person) do attribute :name attribute :alive attribute :address, view: :state end end subject(:output) { vi...
# frozen_string_literal: true require 'rails_helper' RSpec.describe ItemsController, type: :controller do let(:valid_attributes) do skip('Add a hash of attributes valid for your model') end let(:invalid_attributes) do skip('Add a hash of attributes invalid for your model') end let(:valid_session) ...
module API module V1 class BaseController < ApplicationController def index head status: :ok end end end end
class AdminController < ApplicationController before_filter :require_login, :except => [:loggingIn, :login, :setup, :createSetup] protect_from_forgery def index @products = Product.find(:all, :order => "featured DESC, created_at DESC") end def loggingIn if session[:user_id] == nil @user = User...
# --------------------------------------------------------------------------- # # A palindromic number reads the same both ways. The largest palindrome made # from the product of two 2-digit numbers is 9009 = 91 × 99. # # Find the largest palindrome made from the product of two 3-digit numbers. # ---------------------...
# A featured number (something unique to this exercise) is an odd number that # is a multiple of 7, and whose digits occur exactly once each. So, for # example, 49 is a featured number, but 98 is not (it is not odd), 97 is not # (it is not a multiple of 7), and 133 is not (the digit 3 appears twice). # Write a method ...
class CreateJobs < ActiveRecord::Migration[6.1] def change create_table :jobs do |t| t.integer :user_id t.string :title t.string :position t.string :location t.string :experience t.string :salary t.integer :openings t.string :employment_type t.string :educatio...
class Reservation < ActiveRecord::Base belongs_to :listing belongs_to :guest, :class_name => "User" has_one :review validates :checkin, presence: true validates :checkout, presence: true validate :consistent_dates validate :host_and_guest_are_different validate :check_availability # does the sup...
class Slave < ActiveRecord::Base serialize :environment_variables, Hash before_save :cleanup_environment has_many :builds, :dependent => :nullify has_many :running_builds, :class_name => 'Build', :conditions => { :status => 'running' } named_scope :least_busy, :include => :running_builds, :group => '...
class CourseSubject < ApplicationRecord belongs_to :course belongs_to :subject enum status: {pending: 0, started: 1, finished: 2} after_update :update_status scope :of_course_and_subject,->course_id, subject_id do find_by course_id: course_id, subject_id: subject_id end scope :count_status,->statu...
Pod::Spec.new do |s| s.name = 'iLog' s.version = '1.4.0' s.license = { :type => 'MIT', :file => 'LICENSE' } s.homepage = 'https://github.com/leoneparise/iLog' s.authors = { 'Leone Parise' => 'leone.parise@gmail.com' } s.summary = 'iLog log manager. Check you logs in your phon...
class WorksController < ApplicationController before_action :require_login, only: [:index, :new, :create, :destroy, :show, :search] def index @works = Work.all @works = @works.joins(:types).where(types: {id: params[:type_id]}) if params[:type_id].present? end def new @work = Work.new en...
class Admin::UsersController < ApplicationController before_action :authenticate_user! before_action :authenticate_admin before_action :set_user, :only => [ :edit, :update, :destroy] def edit end def update if @user.update( user_params ) redirect_to admin_posts_path else flash.now[:al...