text
stringlengths
10
2.61M
module Airmodel class Model < Airtable::Record extend Utils extend Associable def self.all Query.new(self).all end def self.where(args) Query.new(self).where(args) end def self.by_formula(args) Query.new(self).by_formula(args) end def self.search(args) Q...
require File.dirname(__FILE__) + '/../../spec_helper' describe 'S3.get_bucket_location' do before(:all) do @s3 = Fog::AWS::S3.gen @eu_s3 = Fog::AWS::S3.gen(:eu) @s3.put_bucket('foggetlocation', 'LocationConstraint' => 'EU') end after(:all) do if Fog.mocking? @eu_s3.data = @s3.data end...
require 'rails_helper' # create a new post type def create_post_type visit "#{cama_root_relative_path}/admin/settings/post_types" expect(page).to have_content('Post') expect(page).to have_content('Page') within('#post_type_form') do fill_in 'post_type_name', with: 'Test cat' fill_in 'post_type_slug', w...
# frozen_string_literal: true class AddColumnsToZoneCaches < ActiveRecord::Migration[6.0] def change change_table :v2_zone_caches, bulk: true do |t| t.jsonb :streams, default: {}, null: false end end end
class LikesController < ApplicationController def like @post = Post.find(params[:post_id]) current_user.like(@post) respond_to do |format| format.html { redirect_to @user } format.js end end def dislike @post = Like.find(params[:id]).post current_user.dislike(@post) respon...
module Requests module EncodingGet def test_encoding_default server.run do |req, rep| rep.body = %w(Right) end response = client.request(:get,"#{server_uri}/", headers: {"accept" => "*/*", "accept-enc...
require 'rails_helper' RSpec.describe Picture, type: :model do testjinn = Picture.create(image: File.open(File.join(Rails.root + 'app/assets/images/dancing-jinn-satans.jpg')), caption: "Test Jinn Picture") context('it is created with') do it ('a caption') do expect(testjinn.caption).t...
# frozen_string_literal: true require 'rails_helper' RSpec.describe UrlsController, type: :controller do describe 'GET #index' do let(:urls) { double('urls') } before do allow(FetchUrls).to receive(:call).and_return(double(:result, failure?: false, urls: urls)) get :index end it { expe...
class Asteroids::AsteroidDespawnSystem < Gamey::System COMPONENT_MASK = Asteroids::AsteroidComponent.mask | Asteroids::TransformComponent.mask def update(dt) player = entities_with_components(Asteroids::PlayerComponent.mask | Asteroids::TransformComponent.mask).first ...
require 'rails_helper' RSpec.describe "staff_permissions/show", type: :view do before(:each) do @staff_permission = assign(:staff_permission, StaffPermission.create!( :manage_seat => false, :manage_vouchers => false, :manage_show_time => false, :manage_tax_info => false, :manage_pri...
class AddIterations < ActiveRecord::Migration def change create_table :iterations, :force => :cascade do |t| t.belongs_to :engagement t.text :customer_feedback t.datetime :end_date t.timestamps end end end
# PDUs are the protcol base units in SMPP module Smpp::Pdu class Base # Error constants ESME_ROK = 0x00000000 # OK! ESME_RINVMSGLEN = 0x00000001 # Message Length is invalid ESME_RINVCMDLEN = 0x00000002 # Command Length is invalid ESME_RINVCMDID = 0x00000003 # Inva...
# # Tests de la class User # require 'spec_helper' describe User do # ------------------------------------------------------------------- # Classe # ------------------------------------------------------------------- describe "La classe" do describe "Constante" do it "BIT_ADMIN et autre valeur de statut ...
class Point include Mongoid::Document field :points, type: Integer field :user_id, type: String field :name, type:String # Relationships. belongs_to :users has_many :charities end
module API module Helpers extend self def serialize_response(resource) resource.errors.blank? ? resource : serialize_error(resource) end def serialize_error(resource) message = resource.errors.messages.first.first.to_s.humanize + ' ' + resource.errors.messages.first.second.to_sentence ...
json.array!(@programmes) do |programme| json.extract! programme, :title, :description, :date, :location json.url programme_url(programme, format: :json) end
require 'rails_helper' RSpec.describe 'As an authenticated user' do context 'When I visit /notes/new' do xit "I can create a new note" do user_logs_in user = User.first paragraph = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." visit new_note_path fill_in "note[title]...
require "test_helper" require "binary_tree" describe "binary_tree" do p = Tree.new('Peter') a = Tree.new('Andrea') k = Tree.new('Katie',p,a) j = Tree.new('Jony',Tree.new('Dan'),k) ph = Tree.new('Phil',Tree.new('Craig'),Tree.new('Eddie')) a_team = Tree.new('Tim',j,ph) describe "preorder method" do pr...
require 'spec_helper' describe Wombat::Crawler do before(:each) do @crawler = Class.new @crawler.send(:include, Wombat::Crawler) @crawler_instance = @crawler.new end describe '#crawl' do it 'should call the provided block' do event_called = false @crawler.event { event_called = true...
# # Author:: Matthew Macdonald-Wallace (mmw@greenandsecure.co.uk) # Copyright:: Copyright (c) 2012 Green and Secure IT Limited # # Shamelessly based on the ec2 plugin by: # # Author:: Tim Dysinger (<tim@dysinger.net>) # Author:: Benjamin Black (<bb@opscode.com>) # Author:: Christopher Brown (<cb@opscode.com>) # Licens...
class Admin::AdminsController < Admin::BaseController def index @admins = Admin.all end def new @admin = Admin.new end def create @admin = Admin.new(admin_params) respond_to do |format| if @admin.save format.html { redirect_to @admin, no...
class Question < ApplicationRecord has_many :question_similar_words, dependent: :destroy accepts_nested_attributes_for :question_similar_words,allow_destroy: true #空欄禁止 validates :question, presence: true, uniqueness: true validates :description, presence: true, uniqueness: true def self.search(search) #se...
module UserCreator include BCrypt def self.for(params) user = User.create!(email: params[:email], phone_number: params[:phone_number], password: create_password_hash(params[:password]), key: create_unique_key, full_name...
class StudentsController < ApplicationController include UsersHelper before_filter :authorize_only_for_admin def index @students = Student.all(order: "user_name") end def populate @students_data = Student.all(order: "user_name") # construct_table_rows defined in UsersHelper @students = co...
require 'test/unit' require_relative 'show' class AdvancedBackreferencesAndNamedMatchesTest < Test::Unit::TestCase def setup @show = Show.new end def test_1 # tre modi diversi di ripetere il gruppo. @show.regex('abbc', /(\w)\1/) # un carattere seguito da se stesso --> ll @show.regex('abbc', /(?...
class AddWalletColumn < ActiveRecord::Migration[5.2] def change add_column :wallets, :coin_id, :integer end end
require_relative("../db/sql_runner") require_relative("films.rb") require_relative("customers.rb") class Ticket attr_reader :id attr_accessor :customers_id, :films_id def initialize( options ) @id = options['id'].to_i @customers_id = options['customers_id'].to_i @films_id = options['films_id'].to_i...
class UpdateBackupTables < ActiveRecord::Migration def self.up change_table :backup do |t| t.rename :storage, :type # will use STI from now t.string :md5sum end ActiveRecord::Base.connection.execute "UPDATE backup SET type='Backup::Record::FTP' WHERE type='ftp'" ActiveRecord::Base.con...
require 'rails/railtie' module Voonami module Crumbs # @private class Railtie < Rails::Railtie initializer "voo_crumb.initialize" do |app| ActionController::Base.send :include, Breadcrumbs end end end end
class Raindrops SUBSTITUTIONS = [ { factor: 3, sound: 'Pling' }, { factor: 5, sound: 'Plang' }, { factor: 7, sound: 'Plong' } ].freeze def self.rules SUBSTITUTIONS.map do |substitution| RaindropRule.new(substitution) end end def self.convert(number) RaindropNumber.new(rules, nu...
module Charts module BarChartForClassRoom def chart_for_class_room chart_type = params[:chart_type] || DEFAULT_CHART_TYPE js_chart = default_chart_hash(chart_type) class_room = ClassRoom.find pa...
require 'spec_helper' describe ScrubDataForBuildingsAndUsers do TIMEOUT = 0 GEOCLIENT_URI = "https://api.cityofnewyork.us/geoclient/v1/address.json" GEOCLIENT_MATCHER = /api\.cityofnewyork\.us/ let!(:bbl1) { geoclient_response } let!(:bbl2) { geoclient_response } let!(:building1) { FactoryBo...
class AddTwitterRuleForeignKeyToTweetsTable < ActiveRecord::Migration[6.1] def change add_reference :tweets, :tweet_rule, foreign_key: true end end
class AuthenticationController < ApplicationController def index end def authenticate_user user = User.find_for_database_authentication(email: params[:email]) if user and user.valid_password?(params[:password]) render json: payload(user) else render json: {errors: ['Invalid Username/Password']}, status:...
require "spec_helper" describe Paperclip::Storage::Webdav::Server do let(:response) { double() } let(:image_path) { "/files/image.png" } let(:host) { "http://example.com" } let(:server) { Paperclip::Storage::Webdav::Server.new :url => host } let(:server_with_auth) do credentials = {} credentials[:url...
module Hadupils::Assets class File attr_reader :name, :path def self.determine_name(path) ::File.basename(path) end def self.hiverc_type :FILE end def initialize(path) @path = path @name = self.class.determine_name(path) end def hidden? name[0] == '.' ...
class CreateMotorcycles < ActiveRecord::Migration[5.0] def change create_table :motorcycles do |t| t.string :make, null: false t.string :model, null: false t.integer :cc t.belongs_to :style, index: true t.belongs_to :user, index: true t.timestamps end end end
class RemoveUnwantedDelegates < ActiveRecord::Migration def up # all delegate ids to delete all_delegate_ids = [147, 148, 149, 150, 151, 152, 153, 154, 155] # get delegate records with these ids puts 'getting delegates' delegates = Delegate.where(:all_delegate_id => all_delegate_ids) # delet...
require 'spec_helper' describe ProblemsController do render_views describe "access control" do before(:each) do @user = Factory(:user) @problem = Factory(:problem, :user => @user) end it "should deny access to 'index'" do get :index response.should redirect_to(new_user_sessio...
class TestLauncher < Test::Unit::TestCase def test_application_under_test_is_not_a_wx_app begin Nobbie::Wx::ApplicationLauncher.new("this is not a Wx::App") fail rescue RuntimeError => e assert_equal Nobbie::Wx::ApplicationLauncher::AUT_NOT_WX_APP, e.message end end end
class AddAuthorProfileToEntries < ActiveRecord::Migration def change add_column :entries, :author_profile, :string end end
# frozen_string_literal: true class FakeIdentifierBuilder attr_accessor :ids def initialize(*ids) @ids = ids @ids = ['OneFreeId'] if @ids.empty? end def build(*) @enum_ids ||= ids.to_enum @enum_ids.next end end # rubocop:disable RSpec/FilePath RSpec.describe FakeIdentifierBuilder do it_be...
class CreateSearchIndexTables < ActiveRecord::Migration def change create_table :words do |t| t.string :word, :null => false t.timestamps end add_index :words, :word create_table :game_words do |t| t.references :game t.references :word end end end
require 'spec_helper' require 'crawler/models/post' module Crawler module Models describe UserProfile do before(:each) do FactoryGirl.reload @api = double("api") Thread.current[:api] = @api end describe "::fetch(id)" do it 'fetches the wall of user specified by...
module ApplicationHelper include DeviseHelper include UiHelper def controller?(*controller) controller.include?(params[:controller]) end def action?(*action) action.include?(params[:action]) end def parse_time_str(time_str) utc = ActiveSupport::TimeZone.new("UTC") begin utc.parse(...
# == Schema Information # # Table name: users # # id :integer not null, primary key # username :string # email :string # phone_number :string # first_name :string # last_name :string # phone_verified :boolean default(FALSE), not null # ...
class PrepareForSubtasks < ActiveRecord::Migration def self.up add_column :departments, :short_name, :string, :limit => 6 add_column :jobs, :tasks_list_formatted, :text add_column :jobs, :completed_date, :date Job.reset_column_information Department.reset_column_information Task.reset_co...
module ProviderDSL # Simple rate limiter class RateLimiter def initialize(maximum_calls, time_period) @maximum_calls = maximum_calls @time_period = time_period reset end def wait if @call_countdown.zero? delta = Time.now - @timestamp sleep(@time_period - delta) i...
require File.expand_path('boot', __dir__) # Manually require Rails engines as needed require 'rails' require 'active_model/railtie' # require 'active_job/railtie' require 'active_record/railtie' # require 'active_storage/engine' # require 'action_controller/railtie' # require 'action_mailer/railtie' # require 'action...
require 'features_helper' describe 'Add a book' do before :all do AuthorRepository.new.clear AuthorRepository.new.create(name: 'Kent Beck') AuthorRepository.new.create(name: 'Eric Evans') end after :all do BookRepository.new.clear # AuthorRepository.new.clear end it 'can create a new bo...
# Screencast 17 Part 1 class Calculator def double(number) number*2 end def add(number1, number2) number1+number2 end def subtract(number1, number2) number1-number2 end def multiply(number1, number2) number1 * number2 end def divid...
class Arena < ApplicationRecord has_many :events has_many :users, through: :events validates :name, :city, :state, presence: true validates :name, uniqueness: true enum capacity: [:"1000-10000", :"10000-25000", :"25000-50000", :"50000-100000"] end
Rails.application.routes.draw do namespace :api do namespace :v1 do resources :houses resources :users resources :bills delete 'payer', to: 'users#delete_payer_bill' patch 'paid', to: 'users#paid_bill' end end end
class Genre attr_accessor :songs, :name def initialize (name) @name = name @songs = [] end def add_song(song) @songs << song song.genre = self end def songs @songs end def artists @songs.collect {|song| song.artist} end end
# U2.W4: Pad an Array # Complete each step below according to the challenge directions and # include it in this file. Also make sure everything that isn't code # is commented in the file. # I worked on this challenge [by myself]. # 1. Pseudocode # What is the input? # The input is an array, an integer, and an...
require "graphql/schema_comparator/diff/enum" require "graphql/schema_comparator/diff/union" require "graphql/schema_comparator/diff/input_object" require "graphql/schema_comparator/diff/input_field" require "graphql/schema_comparator/diff/object_type" require "graphql/schema_comparator/diff/interface" require "graphql...
require "test_helper" class UserTest < ActiveSupport::TestCase context "Given context" do setup do create_organizations create_users end should "have a make_active method" do deny @chuck.active @chuck.make_active @chuck.reload assert @chuck.active end shoul...
require_relative '../../db/config' class Teacher < ActiveRecord::Base has_many :rosters, :foreign_key => :teacher_id has_many :students, :through => :rosters validates :email, format: { with: /.+@\w{1,}.\w{2,}/, message: "Must have at least 2 characters before between and after the @ sign and ." } validat...
require 'spec_helper' module Admiral describe Config do let(:state_monitor) { StateMonitor.new } let(:etcd) { Etcd.client } before(:each) do empty_etcd end after(:all) do empty_etcd end describe "#failed_states" do let(:test_data) do JSON.parse('{"loadState":...
require 'selenium-webdriver' Before do @browser = Selenium::WebDriver.for :chrome end Given(/^I open Google home page$/) do @browser.navigate.to 'http://www.google.com' end When(/^I perform a search by (.*)$/) do |search| @browser.find_element(:title, 'Search').send_keys(search).submit end And(/^Open Wikipedi...
module CassandraObject module BelongsTo class Reflection attr_reader :model, :name, :options def initialize(model, name, options) @model, @name, @options = model, name, options end def instance_variable_name "@#{name}" end def foreign_key "#{name}_id" ...
# -*- mode: ruby -*- # vi: set ft=ruby : # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "Master" current_dir = File.expand_path(File.dirname(__FILE__)) config.vbguest.auto_upd...
class CreateActorsMovies < ActiveRecord::Migration def change add_column :movies, :actor_id, :integer add_column :actors, :movie_id, :integer end end
# Get a list of puppet facts associated with servers and write to yaml. # Borrowed in part from https://github.com/sul-dlss/puppetdb_reporter/ namespace :cache do desc 'Load our cache of puppet facts' task puppetfacts: :environment do Cache::Puppetfacts.new.cache end end
require 'net/http' require 'json' require 'uri' require './escape' require 'optparse' require 'fileutils' class FanboxItems def initialize(user_id,cookies) @user_id = user_id @cookies = cookies @query_parameters = {"userId"=>user_id, "maxPublishedDatetime"=>Time.now.strftime("%Y-%m-%d %H:%M:%S"), "maxId"...
class FontCaladea < Formula head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/caladea" desc "Caladea" homepage "https://fonts.google.com/specimen/Caladea" def install (share/"fonts").install "Caladea-Bold.ttf" (share/"fonts").install "Calade...
class AddAdditionalFieldsToHardwareProfile < ActiveRecord::Migration def self.up add_column "hardware_profiles", "model", :string add_column "hardware_profiles", "processor_manufacturer", :string rename_column "hardware_profiles", "processor_type", "processor_model" add_column "hardware_profiles", "...
class BooksController < ApplicationController before_action :set_book, only: [:show, :edit, :update, :destroy] def index @books = Book.all end def show @genres = @book.categories end def new @book = Book.new end def edit end def create @book = Book.new(book_params) if @book....
pg_ver = input('pg_version') control "V-73023" do title "The system must provide a warning to appropriate support staff when allocated audit record storage volume reaches 75% of maximum audit record storage capacity." desc "Organizations are required to use a central log management system, so, under normal ...
class PasscodeMailer < ActionMailer::Base default from:Tolaria.config.from_address def passcode(administrator, passcode) @administrator = administrator @passcode = passcode mail(to:administrator.email, subject:"#{@passcode} is your #{Tolaria.config.company_name} passcode") end end
class Pangrams def initialize(line) @line = line @not_used = (('a'..'z').to_a - @line.downcase.chars.to_a) end def pangram @not_used.empty? ? 'NULL' : @not_used.join('') end end a = Pangrams.new('A quick brown fox jumps over the lazy dog') puts a.pangram
WebApp::Application.routes.draw do root to: 'static_pages#home' #get "static_pages/home" match 'home' => 'static_pages#home' # match 'portfolio' => 'static_pages#portfolio' # match 'services' => 'static_pages#services' # match 'about' => 'static_pages#about' # match 'blog' => 'stati...
class SparklyGenerator < Rails::Generator::NamedBase def source_root File.join(File.dirname(__FILE__), 'templates') end def initialize(args, options = {}) #:nodoc: @options = options unless args.empty? which = args.first @type = which.downcase args << "generic" if nameless_type? ...
# frozen_string_literal: true Rails.application.routes.draw do # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html root to: 'pokemon#index' get '/pokemon/index', to: 'pokemon#index' get '/pokemon/about', to: 'pokemon#about' resource :pokemon do member do...
module Transport class CargoCarriage < Carriage def to_s "CargoCarriage №#{number}" end end end
require 'rails_helper' RSpec.describe Request do let(:request) { FactoryGirl.build(:request) } it 'is valid with valid attributes' do expect(request).to be_valid end it { should validate_presence_of(:user) } it { should validate_presence_of(:book) } it { should validate_presence_of(:status) } end
# frozen_string_literal: true class Test < Aid::Script def self.description 'Runs full test suite' end def self.help <<~HELP Usage: aid test Runs all the tests that are needed for acceptance. HELP end def run Rubocop.run Eslint.run Mocha.run SlimLint.run Rspec.r...
# frozen_string_literal: true ActiveAdmin.register Location do permit_params :name, :snippet, :content, :address, :banner filter :name filter :snippet filter :content filter :address form do |f| f.semantic_errors inputs do f.input :name f.input :banner, as: :file f.input :snippe...
require_relative 'spec_helper' require_relative '../lib/DigitalItem' describe Digital do before(:context) do @item = Digital.new('A Christmas Story', 7) end #check initialization describe 'initialization' do it 'should be a digital item' do expect(@item).to be_instance_of(Digital) end ...
class User attr_reader :name, :valid_directions, :items def initialize(name) @name = name @valid_directions = ["N", "S", "E", "W"] @items = [] end def add_item(item) @items << item end def drop_item(item) @items.delete(item) end def pic...
# frozen_string_literal: true require 'spec_helper' describe 'kmod', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts.merge(augeasversion: '1.2.0') end it { is_expected.to contain_class('kmod') } it { is_expected.to contain_file('/et...
require 'rails_helper' RSpec.describe Account, type: :model do describe "necessary associations" do it { is_expected.to have_many(:withdrawals).class_name("Transfer").with_foreign_key(:source_account_id) } it { is_expected.to have_many(:deposits).class_name("Transfer").with_foreign_key(:destination_account_i...
include CalEnd class CalEnd::WeeksController < ApplicationController layout "cal_end" def index list render :action => 'list' end def list @weeks = Weeks.paginate :page=>params[:page], :per_page => 10, :order=>"id" end def show @weeks = Weeks.find(params[:id]) end def new @wee...
class PlacesController < ApplicationController authorize_resource def index @places = Place.all end def new @place = Place.new end def create @place = Place.new(place_params) if @place.save redirect_to places_path else render 'new' end end private def place_pa...
class OrderService attr_accessor :order def initialize @order = Order.new end def pay_pay_order(data) begin @order.company_name = data[:company_name] @order.username = data[:username] @order.email = data[:email] @order.subscription_date = data[:subscription_date] @order.j...
# encoding: utf-8 #! /usr/bin/env ruby ## # Auteur CrakeTeam # Version 0.1 : Date : Mon Mar 17 09:42 2013 # require 'gtk2' require_relative 'Events' require_relative 'EventsEditeur' require './Vue/Fenetres/FenetreTailleEditeur' #===============================================================================# # ...
# encoding: utf-8 module ScriptNotifier class Router def initialize(message) @message = message extract_notifications end def deliver! threads = [] @notifications.each_with_index do |notification, index| threads << Thread.new(notification, index) do |notification, index...
# frozen_string_literal: true require "equivalent-xml" # @api private # Validator for asserting a request was sent with an equivalent XML payload. # # @see https://github.com/mbklein/equivalent-xml # equivalent-xml gem class WebTrap::Shared::Validators::EquivalentXmlContentValidator # Instantiate a new validator ...
# -*- encoding : utf-8 -*- class Sys::SubscriptionMessage include Mongoid::Document include Mongoid::Timestamps field :email, type: String field :nid, type: Integer field :message_type, type: String field :subject, type: String field :body, type: String field :sent, type: Mongoid::Boolean, default: fa...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
class StringSub < String def initialize(input) @input = input end ## COMMENT - Just write @input.downcase == @input.reverse.downcase def pallindrome? (@input.downcase == @input.reverse.downcase) ? true: false end def say_hello "Hi from #{@input}" end end print "Enter the String : " input = gets.chom...
require 'uri' require 'net/http' require 'net/https' require 'json' require 'logger' require 'pry' class Tracker TRACK_URL = "http://localhost:3000/api/v1" TASK_START_URL = TRACK_URL + "/task_instances/start" TASK_END_URL = TRACK_URL + "/task_instances/end" def initialize(task_name, config={}) set_config(...
module RunPal class DeleteChallenge < UseCase def run(inputs) inputs[:challenge_id] = inputs[:challenge_id] ? inputs[:challenge_id].to_i : nil inputs[:user_id] = inputs[:user_id] ? inputs[:user_id].to_i : nil challenge = RunPal.db.get_challenge(inputs[:challenge_id]) return failure(:chal...
class AddEnderecoToAnnouncements < ActiveRecord::Migration def change add_column :announcements, :rua, :string add_column :announcements, :numero, :string add_column :announcements, :complemento, :string add_column :announcements, :cidade, :string add_column :announcements, :estado, :string end ...
class MainController < UIViewController def viewDidLoad super view.addSubview(background_image) @label = make_label view.addSubview(@label) @button = make_predict_button view.addSubview(@button) end private def background_image image = UIImage.imageNamed("background.png") UI...
# -*- mode: ruby -*- # vi: set ft=ruby : # This follows the .travis.yml file. # In places where they differ, .travis.yml is canonical Vagrant.configure(2) do |config| config.vm.box = "ubuntu/precise64" config.vm.synced_folder "..", "/home/vagrant/ansible-role-ffmpeg", type: "rsync" config.vm.provision "shell",...
# frozen_string_literal: true FactoryBot.define do factory :measurement, class: 'Measurement' do glicemy { 100 } date { Date.today } time { Time.now } user end end
# An apple a day keeps the doctor away class UsersController < ApplicationController def index redirect_to root_path end def show @user = User.find(params[:id]) redirect_to root_path unless current_user # ====== mail test ====== # mail to user when he enter the user#show. It worked! # Use...
class Course < ApplicationRecord LEVELS = %i[Beginner Intermediate Advanced] LANGUAGES = %i[English Spanish French] has_rich_text :description belongs_to :user validates :title, :short_description, :language, :price, :level, presence: true validates :description, presence: true, length: { :minimum => 5 } ...
class RemoveTagFromVideos < ActiveRecord::Migration def change remove_column :videos, :tag, :string end end