text
stringlengths
10
2.61M
class Blog::CategoriesController < ApplicationController def show @category = Blog::Category.find params[:id] @posts = @category.posts.visible end end
class AddColumnsToContacts < ActiveRecord::Migration def change add_column :contacts, :unknown_year, :boolean add_column :contacts, :unknown_birthday, :boolean add_index :contacts, :unknown_year add_index :contacts, :unknown_birthday end end
require 'rails_helper' RSpec.describe InvoiceItem do describe "visiting invoice items pages" do before(:each) do @invoice_item = create(:invoice_item) @invoice_item_1 = create(:invoice_item) end it "can visit an invoiceitem show page" do get "/api/v1/invoice_items/#{@invoice_item.id}" ...
require 'spec_helper' describe Category do fixtures :categories, :sub_categories, :categories_sub_categories before(:each) do @valid_attributes = { :category => "Healthcare" } end it "should create a new instance given valid attributes" do Category.create!(@valid_attributes) end it "should requ...
# frozen_string_literal: true class ImeiValidator attr_reader :number def initialize(number) @number = number end def result sum = 0 (0..14).each do |i| sum += digit_calculation(number.to_s[i].to_i, (i + 1).even?) end return true if (sum % 10).zero? false end private d...
require "json" require "selenium-webdriver" require "test/unit" class LogIn < Test::Unit::TestCase def setup @driver = Selenium::WebDriver.for :chrome @base_url = "https://secure.shore.com/merchant/sign_in" @accept_next_alert = true @driver.manage.timeouts.implicit_wait = 30 @verification_errors...
class ContaPage < SitePrism::Page element :input_nome, '#signup-email-input-name' element :input_email, '#signup-email-input-email' element :input_senha, '#signup-email-input-password' element :input_cpf, '#signup-email-input-document' element :input_celular, '#signup-email-input-phone' element...
class Integer ROMAN = [['I', 'V'], ['X', 'L'], ['C', 'D'], ['M']] def to_roman digits.each_with_index.with_object('') do |(number, index), roman| next if number.zero? case number when 1..3 roman.prepend(ROMAN[index][0] * number) when 4 roman.prepend(ROMAN[index][0] + ROM...
# frozen_string_literal: true require 'rails_helper' describe CatalogFormatter do include TestLinksHelpers describe 'test support code in `TestLinksHelpers`' do let(:taxon) { build_stubbed :any_taxon } it 'returns the same as this code' do expect(described_class.link_to_taxon(taxon)).to eq taxon_l...
Dir['./models/*.rb'].each {|f| require f } ENV['RACK_ENV'] = 'test' require 'minitest/autorun' require File.expand_path '../../../mainController', __FILE__ class BasicTests < Minitest::Test include Rack::Test::Methods def app MainController end def test_get_root get '/index' assert_equal 200, last_resp...
require 'spec_helper' module Alf module Operator::NonRelational describe Sort do let(:operator_class){ Sort } it_should_behave_like("An operator class") let(:input) {[ {:first => "a", :second => 20, :third => true}, {:first => "b", :second => 10, :third => fals...
class Bitcoin < ApplicationRecord # btcの買値のレートを保存していく def self.get_rate ['buy', 'sell'].each do |order_type| result = Transaction.new.get_rate(order_type) bitcoin = Bitcoin.new(order_type: order_type, rate: result['rate']) bitcoin.save end end def self.destroy_all_data bitcoins =...
class Publication < ActiveRecord::Base has_and_belongs_to_many :people has_and_belongs_to_many :projects end
class Point < Currency validate :validate_incrementation_limit, if: :value_changed? protected def validate_incrementation_limit if last_transmutation_date.today? && last_transmutation_amount > 0 && (value - value_was) > 0 errors.add(:value, "cannot be incremented any further today") end unless la...
module Livecode module Extensions module String def chance?; true; end alias :c? :chance? end end end
class ProcessInformation < ActiveRecord::Base belongs_to :workflow_information belongs_to :creater, class_name: "User" belongs_to :user, class_name: "User" belongs_to :parent_case, class_name: "ProcessInformation" has_many :workflow_comments, foreign_key: "process" has_many :sub_cases, class_name: "ProcessI...
module API::V1 class Auth < Grape::API include API::V1::Defaults helpers do def user_params clean_params(params).require(:user).permit(:email, :password, :password_confirmation) end end namespace 'auth' do desc "注册" params do requires :user, type: Hash d...
# == Schema Information # Table name: flights # id :integer not null, primary key # airline :string # origin :string # destination :string # arrival_time :string # departure_time :string # duration :string # max_occupancy :integer # created_at :datetime ...
class ChangeRedeemptionToItems < ActiveRecord::Migration def change add_column :items, :redemption_value, :integer remove_column :items, :redeemtion_value end end
# The SNMP4EM library module SNMP4EM class Manager include SNMP4EM::CommonRequests # # @pending_requests maps a request's id to its SnmpRequest # @pending_requests = {} @socket = nil class << self attr_reader :pending_requests attr_reader :socket def init_s...
$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require "numeric" require "test/unit" class TestNumeric < Test::Unit::TestCase def test_to_letter assert_equal("A", 0.to_letter ) assert_equal("B", 1.to_letter ) assert_equal("C", 2.to_letter ) assert_equal("", 3.to_letter ) assert_e...
require 'zlib' require 'open-uri' namespace 'gene' do desc 'Returns total number of Genes in database' task :total do puts Gene.all.size end desc 'Loads the protein sequences into the databases' task :load => :clear do file_name = "protein.fasta.gz" file_gz = File.join(File.expand_path('../....
#!/usr/bin/env ruby require File.expand_path(File.dirname(__FILE__) + '/../lib/cbtdg-ruby') require 'optparse' options = {:m => nil, :o => nil} parser = OptionParser.new do |opts| opts.banner = "Usage: cbtdg.rb [options] " opts.on('-m filePath', '--modelFilePath filePath', 'Path to file containing model and const...
class EventsController < ApplicationController # include GroupEventsHelper def index # GET events = Event.includes(:reservations).where(group_id: params[:group_id]).order(:start_time) group = Group.find_by(id: params[:group_id]) group_events = { events: events.as_json(include: :reservations), grou...
require 'spec_helper' module Netzke::Basepack describe Columns do it "should provide correct list of default fields for forms" do fields = BookGridWithCustomColumns.new.send :default_fields_for_forms fields.map{|f| f[:name]}.should == %w[id author__first_name author__last_name author__name title digi...
module Seofy module Adapters class Base36 < Base attr_reader :options, :length, :column def initialize(options={}) super(options) @length = options[:length] end def seofy_slug(inst) inst.send(self.column) end def set_seofy_slug(inst) slug_exis...
class SpudPhotoAlbum < ActiveRecord::Base attr_accessible :title, :url_name, :photos, :photo_ids has_many :spud_photo_albums_photos, :dependent => :destroy has_many :photos, :through => :spud_photo_albums_photos, :source => :spud_photo, :order => 'spud_photo_albums_photos.sort_order asc' has_many...
class Video < ActiveRecord::Base belongs_to :category validates_presence_of :title, :description has_many :reviews has_many :queue_items scope :search, -> (search_term) { where("title LIKE ?", "%#{search_term}%") } def self.search_by_title(search_term) return [] if search_term.blank? search search...
class CreateProductOptions < ActiveRecord::Migration[5.0] def change create_table :options, id: :uuid do |t| t.string :name t.integer :position t.text :values, array: true, default: [] t.integer :owner_id t.integer :owner_type t.timestamps end add_index :options, [:owne...
class ApplicationController < ActionController::Base protect_from_forgery with: :exception private def rate_limit ip = request.remote_ip RequestCount.where(ip: ip).where("created_at < ?", Time.now - Rails.application.config.rate_limit_seconds.seconds).destroy_all if request_count = RequestCount.fin...
require 'rubygems' require 'sqlite3' require 'mysql2' require 'shellwords' # Download and extract the following dumps into this directory: WIKIDUMPS = ENV['WIKIDUMPS'] LANGLINKS_FILE = Dir.glob("#{WIKIDUMPS}/enwiki-????????-langlinks.sql").first ENWIKI_FILE = Dir.glob("#{WIKIDUMPS}/enwiki-????????-pages-*-*.x...
module Elrond class BlockController < NetworkController layout 'tabs' before_action :set_block before_action :query_date, only: %i[validators notarized_blocks] QUERY = BitqueryGraphql::Client.parse <<-'GRAPHQL' query ($blockHash: String! $network: ElrondNetwork!){ elrond...
class UsersController < ApplicationController before_action :check_admin_and_redirect_login_path, only: %i(index edit update destroy) def index @users = User.all end def new @user = User.new end def create @user = User.new(user_params) return render :new if @user.invalid? @user.save ...
require_relative "../test_helper" class UserViewsSiteDataTest < FeatureTest def test_user_sees_aggregate_data visit "/sources/jumpstartlab" assert_equal "/sources/jumpstartlab", current_path within(".jumbotron") do assert page.has_content?("Jumpstartlab Site Data") end within("#urls") d...
class BaseRequest include ActiveRecord::AttributeAssignment def initialize(params) @params = params end def params @params end def errors @errors ||= schema.call(@params).messages end end
class CreateTaskDelegates < ActiveRecord::Migration def change create_table :task_delegates do |t| t.integer :task_id, :null => false t.integer :staff_from t.integer :staff_to t.timestamp :when t.timestamps end end end
# require 'sinatra' # # Class for route /create/file # class FileSystemSyncAPI < Sinatra::Base # post '/update/metadata/?' do # content_type 'application/json' # begin # username, file_id, gfile_id, drive_space = JsonParser.call(request, 'username', 'file_id', 'gfile_id', 'drive_space') # if user...
class UserInfo < ActiveRecord::Base validates :money, length: { in: 0..Settings.user.max_money } validates :level, length: { in: 0..Settings.user.max_level } validates :max_buildings, length: { in: 0..Settings.user.max_buildings } end
module Spree::Allegro def self.table_name_prefix 'spree_allegro_' end end
#!/usr/bin/env ruby # # object_walker_reader - extract the latest (no arguments), or a selected object_walker dump from automation.log or other renamed or # saved log file. # #Usage: object_walker_reader.rb [options] # -l, --list list object_walker dumps in the file # -f, --file filename ...
namespace :activity do desc "Generate Default Activities" task :generate_default => :environment do ["Yoga", "Skiing", "Canoeing", "Snowshoeing", "Fishing", "Massage", "Cross Country", "Bus Trips", "Scooter Rental", "Bike Rental"].each do |activity_name| Activity.create(name: activity_name) e...
class Spell < ApplicationRecord include Searchable has_and_belongs_to_many :creatures validates :name, :description, presence: true validates :dice, dice: { message: "Dice should be in form 1d4 + 8" } validates :level, presence: true, numericality: { only_integer: true } end
# = FoldersController # class FoldersController < ApplicationController skip_auth :index include FoldersHelper include Attribute::OpenAndCloseAt PER_PAGE = 8 # GET :site/folders # it redirects to articles/index of default folder, def index @site ||= Site.find_by_id(params[:site]) or (render_404 an...
class Comentario < ActiveRecord::Base self.table_name = :comentarios self.primary_key = 'id' belongs_to :especie belongs_to :usuario belongs_to :categorias_contenido, :class_name => 'CategoriasContenido', :foreign_key => 'categorias_contenido_id', :dependent => :destroy has_ancestry has_one :general, :...
class CommentSerializer < ActiveModel::Serializer attributes :id, :comment, :author end
require "oystercard" RSpec.describe Oystercard do FUNDS = 10 LIMIT = 90 let(:top_up) { subject.top_up(FUNDS) } let(:touch_in) {subject.touch_in("Aldgate")} let(:touch_out) {subject.touch_out("Earls Court")} it 'has an initial balance of 0' do expect(subject.balance).to eq(0) end it 'receives a top...
class KazooieController < ApplicationController def index @title = "Kazooie" end end
class Bouncer::Warden attr_writer :session_secret, :strategies, :failure_app, :intercept_401, :api_mode def initialize(builder) @builder = builder end def setup! @builder.use(Rack::Session::Cookie, secret: session_secret) unless defined?(RailsWarden) @builder.use warden_manager do |manager| ...
module UsersHelper def conditionally_present_teachers_courses(user) if user.teacher? tag.div { link_to "Courses I Teach", user_courses_path(user.id), class: "button" } end end def present_edit_button_if_logged_in(user) if session[:user_id] ==...
require 'rails_helper' RSpec.describe Category, type: :model do it "should be able to create a category" do # Teste simples que deve verificar se é salvo no banco com o # uso do comando "Create" category = Category.create( tag:"test", description: "Categoria teste") ex...
class NakkitypeInfosController < ApplicationController before_filter :admin_access skip_before_filter :admin_access, :only => [:party_index] include NakkitypeInfoHelper def party_index current_party = get_current_party nakkitype_descriptions = current_party.nakkitypes.map { |n| n.nakkitype_info } ...
require 'test_helper' class SelectTest < ViewCase setup :sign_in teardown :teardown def test_select_with_active_record_collection # test permission, which proc in options gives an # activerecord array as a response. visit adminpanel.new_permission_path select_selector = find('#permission_role...
class AddSomeModulesToMyMobilePage < ActiveRecord::Migration def up EpmMobileIssuesAssignedToMe.install_to_page('my-mobile-page') EpmMyProjectsSimple.install_to_page('my-mobile-page') end def down EpmMobileIssuesAssignedToMe.destroy_all end end
module Meta class MapsController < MetaController skip_before_action :require_any_admin_permissions, only: [:show] skip_before_action :require_meta, only: [:show] before_action(except: [:index, :new, :create]) { @map = Map.find(params[:id]) } def index @maps = Map.all end def new ...
module User::Operation class Create < Trailblazer::Operation class Present < Trailblazer::Operation step Model(User, :new) step Contract::Build(constant: User::Contract::Base) end step Nested( Present ) step :current_user! step Contract::Validate( key: :user ) step Contract::Persis...
require 'rails_helper' describe Review do describe "#net_rating" do it "returns the net of all the review's up and down votes" do item = create(:item) review = create(:review, item: item) user_1 = create(:user) user_2 = create(:user) user_3 = create(:user) create(:upvote, revi...
# frozen_string_literal: true Rails.application.routes.draw do namespace :v1 do resources :movies, only: :index end end
#!/usr/bin/env ruby require 'icalendar' require 'net/http' ENV['RAILS_ENV'] ||= 'development' require File.expand_path('../../config/environment', __FILE__) sources = Source.where(approved: true) def create_or_update_event(icaluid, attributes) # create a new event or update an existing one puts icaluid puts ...
COMPLIMENTS = [ 'Brilliant job!', 'Outstanding work!', 'Great job!', 'Now you\'ve got it! Awesome!', 'You have a lot of talent!', 'Superior!', 'Fantastic!', 'Right on!', 'Outstanding!', 'You\'re the best!', 'Nice job', 'That\'s a commendable job.', 'Wonderful!', 'Fabulous!', 'You did it!', 'Good going!', 'You\'re great...
describe "Palette Pane Test" do before(:all) do show_control :palette_pane @app = App.get_instance @create_palette = @app['#create-palette', ButtonView] @reset = @app['#reset-palette-id-counter', ButtonView] end before(:each) do @reset.click end it "will create a palette pane an...
require 'rubygems' require 'rubygems/package_task' require 'rake/testtask' require 'rdoc/task' task :default => [:test] Rake::TestTask.new do |t| t.test_files = ['test/tc_dancing_links.rb'] t.verbose = true end Rake::RDocTask.new do |rd| rd.main = "README.rdoc" rd.rdoc_files.include("README.rdoc", "lib/**/*....
class MembersController < ApplicationController def new @member = Member.new end def index end def create member = Member.create!(member_params) redirect_to member end def show @member = Member.find(params[:id]) end def destroy member = Member.find(params[:id]) member.destr...
module ReportsKit module Reports module FilterTypes class Base attr_accessor :settings, :properties, :primary_dimension def initialize(settings, properties, primary_dimension:) self.settings = settings || {} self.properties = properties self.primary_dimension =...
# Seeds Properties # # Property Entity # id human_ref client id Type Title Init. Name # 1 1001 1 1 Prop Mr E P Hendren # 2 2002 1 2 Prop Mr M W Gatting # 3 3003 2 3 Prop Mr J W Hearne # 4 4004 3 4 Prop Mr J D B Robertson # Agents #...
class Category < ActiveRecord::Base # has_and_belongs_to_many :products has_many :category_products has_many :products, through: :category_products belongs_to :parent_category, class_name: "Category" has_many :sub_categories, class_name: "Category", foreign_key: :parent_category_id end
#!usr/bin/ruby require 'active_record' require 'models/cable' require 'time' puts "Setting Timezone to UTC" Time.zone = :utc ActiveRecord::Base.time_zone_aware_attributes = true ActiveRecord::Base.default_timezone = :utc cables_folder = File.join(File.dirname(__FILE__), '../public/cable') raise "No cables found in ...
require 'test_helper' class FileCheckerTest < Minitest::Test def setup @file_checker = Object.new @file_checker.extend(MazeCrosser::FileChecker) end def test_that_check_returns_the_file_if_there_is_one file_path = 'test/test_files/test_maze.txt' file = @file_checker.check file_path assert_eq...
require 'singleton' module Sagrone class Client include Singleton attr_accessor :url attr_reader :api def configure yield self @api = Her::API.new @api.setup url: @url do |c| c.use Faraday::Request::UrlEncoded c.use Her::Middleware::DefaultParseJSON c.us...
require 'test/unit' require 'pathname' require 'digestion' FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures') FIXTURES = Pathname.new(FIXTURE_LOAD_PATH) module Rails; end class BasicController attr_accessor :request def config @config ||= ActiveSupport::InheritableOptions.new(ActionControl...
module GotFixed module Generators class InstallGenerator < ::Rails::Generators::Base desc "Install GotFixed into your app (config + route)" source_root File.expand_path("../templates", __FILE__) def copy_default_config copy_file "got_fixed.yml", "config/got_fixed.yml" end ...
class Poll include Mongoid::Document include Mongoid::Timestamps field :name, :type => String field :owner_email, :type => String field :owner_key, :type => String key :name before_create :generate_owner_key validate :check_for_collision, :on => :create validates_presence_of :name validates_presenc...
=begin doctest: last_modified >> f = File.open('test_mod', 'w') >> f.close >> tm = File.mtime('test_mod') >> last_modified('test_mod', 2) => 'file was last modified 0.0 days ago' >> puts last_modified('../test.rb') =end def last_modified( file, digits = 15 ) days = ( Time.now - File.mtime(file) ) / ( 60*60*24...
# encoding: utf-8 require File.dirname(__FILE__) + '/spec_helper.rb' describe RandomText do it "should create RandomText objects for each text file" do Dir.glob(File.join(File.dirname(__FILE__), '..', 'resources', '*.txt')) do |path| RandomText.const_get(RandomText.classify(File.basename(path, File.extname...
module HTTP class Textbooks < Scraped PROPERTIES = %w(author title publisher isbn retail) ssl false domain 'eduapps.mit.edu' def textbooks(mit_class) get 'textbook/books.html', Term: mit_class.semester, Subject: mit_class.number clean_textbooks extract_textbooks end private ...
require 'rails_helper' describe User do it "is valid with fullname, phone, email, password, and password confirmation" do expect(build(:user)).to be_valid end it "is invalid without fullname" do user = build(:invalid_user) user.valid? expect(user.errors[:fullname]).to include("can't be blank") ...
require 'test/unit' require 'mocha/test_unit' require 'appium_lib' require 'test_object_test_result_watcher' class TestTestObjectTestResultWatcher < Test::Unit::TestCase def setup @driver = Object.new @driver.stubs(:session_id).returns('my_session_id') @driver.stubs(:quit).returns @desired_capabilit...
require_dependency 'story_query' class StoriesController < ApplicationController def index params.permit(:user_id, :group_id, :news_feed, :page) if params[:user_id] user = User.find(params[:user_id]) stories = StoryQuery.find_for_user(user, current_user, params[:page], 30) elsif params[:grou...
require 'conjur_client' class OrgSpacePolicy include ConjurApiModel class OrgPolicyNotFound < RuntimeError end class SpacePolicyNotFound < RuntimeError end class SpaceLayerNotFound < RuntimeError end class << self def ensure_exists(org_id, space_id, organization_name, space_name) OrgSpace...
require 'test_helper' class SiteLayoutTest < ActionDispatch::IntegrationTest def setup @user = users(:jane) end test "layout links as logged-in user" do log_in_as(@user) get root_path assert_template 'users/index' assert_select "a[href=?]", root_path assert_select "a[href=?]", employers...
require 'spec_helper' describe Event do before do @event = Event.new(content: "test event", date: Date.current, type_id: 1) end subject { @event } it { should respond_to(:content) } it { should respond_to(:date) } it { should respond_to(:type_id) } it { should be_valid } context "associations--" do it "be...
namespace :db do task :populate => :environment do require 'faker' 800.times do a = Author.create first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, nationality: Faker::Address.country author_start_publication = Faker::Date.between(100.years.ago, 5.years.ago) (1..55).to...
class HookClient include Redis::Objects extend ActionView::Helpers::DateHelper hash_key :daily_sent_sms_counts, global: true hash_key :monthly_sent_sms_counts, global: true counter :all_time_sent_sms_count, global: true hash_key :daily_received_sms_counts, global: true hash_key :monthly_received_sms_cou...
require 'spotify_web/resource' require 'spotify_web/artist' require 'spotify_web/restriction' require 'spotify_web/schema/metadata.pb' module SpotifyWeb # Represents an album on Spotify class Album < Resource self.metadata_schema = Schema::Metadata::Album def self.from_search_result(client, attributes) #:...
class Transaction < ActiveRecord::Base belongs_to :payer, :class_name => 'User' belongs_to :payee, :class_name => 'User' belongs_to :request validates :payer, presence: true validates :payee, presence: true validates :amount, presence: true validates :request, presence: true # def self.login(name, ema...
module Jekyll module Commands class Clean < Command class << self def init_with_program(prog) prog.command(:clean) do |c| c.syntax 'clean [subcommand]' c.description 'Clean the site (removes site output and metadata file) without building.' c.action do...
class Product < ApplicationRecord belongs_to :user has_many :paymments has_many :qualifications has_attached_file :photo, styles: { medium: "500x500>", thumb: "150x150>" }, default_url: "/images/:style/missing.png" validates_attachment_content_type :photo, content_type: /\Aimage\/.*\z/ end
class TechnologiesController < ApplicationController def index @technologies = current_user.technologies end end
require 'pry' require './lib/char_map' class Rotator attr_accessor :rotations def initialize @rotations = [] @char_map = CharMap.new end def load_rotations(key, date) key_rotations = load_key_rotation(key) date_rotations = load_date_rotation(date, 4) @rotations = key_rotations.map.with_i...
class TicketsChange < ActiveRecord::Migration def up remove_column :tickets, :status end def down add_column :tickets, :status, :integer end def change add_column :tickets, :status, :integer, :default => 0 end end
class Category < ActiveRecord::Base validates_presence_of :description, :on => :create, :message => "can't be blank" validates_uniqueness_of :description, :on => :create, :message => "must be unique" # belongs_to :category, :class_name => "Category", :foreign_key => "parent_id" has_many :categories, :foreign...
# frozen_string_literal: true require_relative '../../lib/movement/castling_movement' require_relative '../../lib/movement/basic_movement' require_relative '../../lib/board' require_relative '../../lib/pieces/piece' RSpec.describe CastlingMovement do describe '#update_pieces' do subject(:movement) { described_c...
class CreateStories < ActiveRecord::Migration def change create_table :stories do |t| t.string :title t.integer :kinja_id t.string :domain t.text :url t.text :author t.text :tweet t.text :fb_post t.datetime :publish_at t.boolean :set_to_publish, default: false...
module Fixjour module Definitions # Defines the new_* method def define_new(klass, &block) define_method("new_#{name_for(klass)}") do |*args| Generator.new(klass, block).call(self, args.extract_options!.symbolize_keys!) end end # Defines the create_* method def define_create...
class AddInitiativesToPending < ActiveRecord::Migration[5.1] def change add_column :pending_companies, :initiative_id, :integer end end
module Inviteable extend ActiveSupport::Concern INVITE_KEY = 'e0f4da9832b9075e04b546062e9faefe' INVITE_CIPHER = "des-ede3-cbc" module ClassMethods def find_by_invite_code code des = OpenSSL::Cipher::Cipher.new(INVITE_CIPHER) des.decrypt des.key = INVITE_KEY decoded = Base64.decode6...
# frozen_string_literal: true module RbLint class Runner attr_reader :reporter def initialize(reporter = Reporter.new) @reporter = reporter end def run(pattern, config = {}) rules = Rules.from(config) violations = {} Dir.glob(pattern).each do |path| parser = Parser....
class Comment < ApplicationRecord belongs_to :user belongs_to :post validates :text, presence: true, length: { maximum: 100 } def template ApplicationController.renderer.render partial: 'comments/comment', locals: { comment: self } end end
class ChangeCreatedAtToBlog < ActiveRecord::Migration[5.2] def change change_column :blogs, :created_at, :timestamp end end
require 'spec_helper' describe 'VerifiedBusinessCustomer models' do # Controller let(:controllerFirstName) { double 'controllerFirstName' } let(:controllerLastName) { double 'controllerLastName' } let(:controllerTitle) { double 'controllerTitle' } let(:controllerDateOfBirth) { double 'controllerDateOfBirth'...
class AddSiteDomainToFirstSetup < ActiveRecord::Migration def change add_column :first_setups, :site_domain, :string end end