text
stringlengths
10
2.61M
# migration to add reference to Tutorials in Videos class AddTutorialsToVideos < ActiveRecord::Migration[5.2] # frozen_string_literal: true def change add_reference :videos, :tutorial, index: true end end
# frozen_string_literal: true class AddDurationToPlaylist < ActiveRecord::Migration[6.1] def change add_column :playlists, :duration, :bigint, default: 3600 end end
class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable has_many :posts, dependent: :destroy has_many :comments, dependent: :destroy has_many :votes, dependent: :destroy has_many :favorites, ...
class CreateConcepts < ActiveRecord::Migration[5.0] def change create_table :concepts do |t| t.integer :code t.string :name t.string :c_name t.timestamps end add_index :concepts, [:code, :c_name] end end
# frozen_string_literal: true require "rails_helper" describe AdminConstraint do subject(:contraint) { described_class.new } describe "#matches?" do context "when there is no admin session" do let(:request) { Rack::Request.new({}) } it "returns false" do expect(contraint).not_to be_match...
Helpus::Application.routes.draw do root :to => "index#cover" devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } match 'home' => 'index#home', :as => 'user_root' match 'about-us' => 'index#about', :as => 'about' match 'contact-us' => 'index#contact', :as => 'contact' m...
require_relative "spec_helper" require "cfa/grub2/grub_cfg" require "cfa/memory_file" describe CFA::Grub2::GrubCfg do let(:memory_file) do path = File.expand_path("../fixtures/grub.cfg", __FILE__) CFA::MemoryFile.new(File.read(path)) end subject(:config) do res = CFA::Grub2::GrubCfg.new(file_handler:...
#!/usr/bin/env rvm-auto-ruby require 'benchmark' # Ovdje koristimo linearnu ili sekvencijalnu pretragu kao primjer. # Pretraga velikog niza sa 10 miliona mnogo će duže trajati od # pretrage malog niza od 1000 članova. def linear_search(array, value) array.each { |i| return i if i == value } end mali_niz = (0..100...
module Characterize class Railtie < ::Rails::Railtie config.after_initialize do |app| app.config.paths.add "app/characters", eager_load: true end if defined?(ActiveRecord) initializer "characterize.active_record" do |app| ActiveRecord::Base.send(:include, Characterize) end e...
class ProductsController < ApplicationController def index @search = params[:q] @filters = params[:filters] || {} results = Product.search(@search, @filters.to_hash) @products = results.page(params[:page]).records @aggregations = AggregationsCollection.build_from_results(results) end end
module ApplicationHelper # This will be the method for adding line items to orders. def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builde...
class CreateDonations < ActiveRecord::Migration def change create_table :donations do |t| t.string :name t.string :twitter t.string :email t.float :amount t.date :created_on t.integer :event_id t.timestamps end end end
require 'open3' require 'tmpdir' require 'support/example_from_directory' require 'support/helpers/emulation_helper' require 'support/helpers/readability_helper' RSpec.describe 'the translator' do include EmulationHelper include ReadabilityHelper TRANSLATOR_PATH = File.expand_path('../../../bin/translator', __F...
class TimeRange < ActiveRecord::Base belongs_to :plan def kwatts_to_cost(kwatts) { name: plan.name, start_hour: start_hour, end_hour: end_hour, calculated_kwatts_cost: (kwatts * kwatt_cost).to_s[0..3] } end end
# frozen-string-literal: true require File.join(File.dirname(__FILE__), 'helper') class WAVExamples < Test::Unit::TestCase DATA_FILE_PREFIX = 'test/data/wav-' context 'TagLib::RIFF::WAV::File' do should 'Run TagLib::RIFF::WAV::File examples' do # Reading the title title = TagLib::RIFF::WAV::File....
module Mud module Entities COLORMAP = { :off => "\033[0m", :bold => "\033[1m", :red => "\033[31m", :green => "\033[32m", :yellow => "\033[33m", :blue => "\033[34m" } module HasRoom #accessor def room W.rooms[@room] end #setter def r...
require 'rails_helper' RSpec.describe Vote, type: :model do let!(:user) {User.create!(name: 'VanVan',location: 'Cuba',username: 'aquinomas',password: 'aquinomas')} let!(:lionking) {User.create!(name: 'lionking',location: 'tanzania',username: 'lionking',password: 'lionking')} let!(:question) {Question.create(titl...
require 'rails_helper' require 'pry' RSpec.describe "sessions/new", type: :feature do context "logged out" do it "renders successfully" do visit login_path expect(page.status_code).to eq(200) end it "contains a form" do visit login_path expect(page).to have_css("form") end ...
# -*- coding: utf-8 -*- =begin Karen West - Saas1, take3 - homework#1 question #7 - July 19th, 2013 HW 1-7: Iterators, Blocks, Yield Given two collections (of possibly different lengths), we want to get the Cartesian product of the sequences. A Cartesian product is a sequence that enumerates every possible pair from t...
class AddBookNumberToIbtrs < ActiveRecord::Migration def self.up add_column :ibtrs, :book_no, :string end def self.down remove_column :ibtrs, :book_no end end
require 'spec_helper' describe "group_waitings/show" do before(:each) do @group_waiting = assign(:group_waiting, stub_model(GroupWaiting, :user_id => 1, :group_id => 2 )) end it "renders attributes in <p>" do render # Run the generator again with the --webrat flag if you want to use ...
require "rails_helper" RSpec.describe Job, type: :model do let!(:company) { Company.create!(name: "acme", information: "asdf") } let!(:job) { company.jobs.create!(title: "Job 1", description: "Job 1 description") } it "is valid" do exp...
FactoryBot.define do factory :item_review do sequence(:review) { |n| "TEST_REVIEW_#{n}" } item_id { 1 } end end
class AddIndexToInventoriesItemnumber < ActiveRecord::Migration def change add_index :inventories, [:itemnumber, :store_id], unique: true end end
# frozen_string_literal: true module Decidim module Opinions OpinionType = GraphQL::ObjectType.define do name "Opinion" description "A opinion" interfaces [ -> { Decidim::Comments::CommentableInterface }, -> { Decidim::Core::CoauthorableInterface }, -> { Decidim::Core::...
# == Schema Information # # Table name: campaigns # # id :integer not null, primary key # user_id :integer not null # goal_amt :integer not null # current_amt :integer not null # title :s...
class Ingredient # One Recipe to many Ingredients, while a single Ingredient can be found in many Recipes. # There are Ingredients that some Users may be allergic to. attr_accessor :name @@all = [] def initialize(name) @name = name @@all << self end # Ingredient.all should return all of t...
class ValueObject # Class methods class << self # @equality_list is a class instance variable that is defined # inside the child class. It persists throughout the life of # that class. def attr_reader(*symbols) @equality_list ||= [] symbols.each do |symbol| super(symbol) ...
class LoginLandingPage < BasePage attr_accessor :button_start def initialize @user_email = Element.new(:xpath, '//div[@id = "userEmail"]') end def visible? @user_email.visible? end end
class NpcShift < ApplicationRecord belongs_to :character_event, inverse_of: :npc_shifts belongs_to :bank_transaction, required: false delegate :character, :event, :accumulated_npc_money, to: :character_event alias_method :etd_pay, :accumulated_npc_money # event-to-date (like ytd) delegate :funds, to:...
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANT_API_VER = "2" #DEFAULT_BOX="ubuntu/trusty64" #DEFAULT_BOX="centos/7" DEFAULT_BOX="bento/centos-7.2" #Configuration nexus_priv_key = File.readlines("nexus.pem") servers = [ { name: "itinerary-external-api", ip: "192.168.33.111" # }, # { name: "itin...
class CreateCategoriasProductosJoin < ActiveRecord::Migration def change create_table :categorias_productos, :id => false do |t| t.integer :categoria_id t.integer :producto_id end end end
require 'test_helper' class SessionsControllerTest < ActionDispatch::IntegrationTest test "should get new" do get login_path assert_response :success end # Log in as a particular user. def log_in_as(user, password: 'password', remember_me: '1') post login_path, params: { session: { email: user.email,...
FactoryBot.define do factory :enemy do name { Faker::Games::LeagueOfLegends.champion } power_base { rand(3000..10_000) } power_step { rand(99..1000) } level { rand(1..99) } kind { %w[goblin orc demon dragon].sample } end end
require 'test_helper' class TodoTest < ActiveSupport::TestCase def setup @user = User.new @user.email = "test@test.com" @user.password = "1234" @user.password_confirmation = "1234" @user.save end test "requires title" do @todo = Todo.new @todo.user = @user assert_not @todo.s...
module Likeable extend ActiveSupport::Concern included do has_many :likes, as: :resource, dependent: :destroy end def total_likes likes.count end end
# Shuffle method class Array def shuffle_it #make a copy of the array shuffled_array = self self.each do |word| #generate two random numbers within the bounds of the array size i = rand(self.length) j = rand(self.length) #randomly swap an element (grab array element...
# An example Jekyll generator. Utilizes the new plugin system. # # 1. Make a _plugins directory in your jekyll site, and put this class in a file there. # 2. Upon site generation, the VERSION file will be created in your root destination with # the version of Jekyll which generated it module Jekyll class VersionR...
# These defaults are used in Geokit::Mappable.distance_to and in acts_as_mappable Geokit::default_units = :miles # others :kms, :nms, :meters Geokit::default_formula = :sphere # This is the timeout value in seconds to be used for calls to the geocoder web # services. For no timeout at all, comment out the...
require 'test_helper' require 'model_test_helper' class FormulationTest < ActiveSupport::TestCase test 'Basic formulation creation & interpretation association' do formulation = Formulation.new( expression: 'Good morning John', locale: 'en' ) formulation.interpretation = interpretations(:wea...
class Whisper < DebianFormula homepage 'http://graphite.wikidot.com/whisper' url 'http://launchpad.net/graphite/1.0/0.9.8/+download/whisper-0.9.8.tar.gz' md5 'c5f291bfd2d7da96b524b8423ffbdc68' arch 'all' name 'whisper' version '0.9.8+github1' section 'python' description 'database engine for fast, reli...
class AddCustomerServiceTable < ActiveRecord::Migration def up create_table :customers do |t| t.integer :organization_id t.string :first_name t.string :last_name t.string :gender t.string :email t.string :state t.string :city t.string :address t.string :postal...
require "spec_helper" RSpec.describe "Day 19: A Series of Tubes" do let(:runner) { Runner.new("2017/19") } let(:input) do <<~TXT | | +--+ A | C F---|----E|--+ | | | D +B-+ +--+ TXT end describe "Part One" do let(:solution) { runner.exe...
control 'postfix' do title 'SMTP listening' desc ' Check Postfix configuration ' describe package('postfix') do it { should be_installed } end describe port(25) do it { should be_listening } its('protocols') { should include 'tcp'} end describe parse_config_file('/etc/postfix/main.cf')...
require 'spec_helper' describe Track do it 'has a valid factory' do FactoryGirl.create(:track).should be_valid end it 'is invalid without a title' do FactoryGirl.build(:invalid_title_track).should_not be_valid end end
require_relative 'base' module Sections class Forces < Base FORCES_SECTION = 0x04 field name: 'target', type: :descendant, klass: 'Force::Target' field name: 'repulsion', type: :descendant, klass: 'Force::Repulsion' end end require_relative 'force/repulsion' require_relative 'force/target'
ActiveAdmin.register Advertisement do form :partial => "form" controller do # POST /adbertisements # POST /adbertisements.xml def create @advertisement = Advertisement.new(params[:advertisement]) unless @advertisement.location.blank? coordinates = Geocoder.coordinates(@advertisement...
require 'rails_helper' RSpec.describe Review, type: :model do it { is_expected.to belong_to :system } it { is_expected.to validate_presence_of :content } it { is_expected.to validate_presence_of :system } end
# frozen_string_literal: true class Flavor < ActiveRecord::Base has_many :beer_flavors has_many :beers, through: :beer_flavors end
# Create an Atm Application that includes: # An Account class # 3 attributes: name, balance, pin # Create 4 additional methods: display_balance, withdraw, deposit, and pin_error. # The user should be prompted to enter their pin anytime they call display_balance, withdraw, or deposit. # pin_error should contain "Acces...
require 'stringio' require_relative '../solution' RSpec.describe 'solution' do subject do expect do Interface.process end.to output(result).to_stdout end before do $stdin = StringIO.new(input) end after do $stdin = STDIN end context 'Example' do let(:input) do <<~INPUT ...
# frozen_string_literal: true class Category < ApplicationRecord belongs_to :categorizable, polymorphic: true has_many :sub_categories, as: :categorizable, dependent: :destroy, inverse_of: :categorizable, class_name: 'Category' belongs_to :user validates :name, length: {in: 1..80} ...
class AddAttributesToVictoryPurchase < ActiveRecord::Migration def change add_column :victory_purchases, :first_name, :string add_column :victory_purchases, :last_name, :string add_column :victory_purchases, :email, :string remove_column :victory_purchases, :user_id end end
$LOAD_PATH.unshift('lib', '../lib') require 'memcached_client' # Run a bunch of sets, forced on one connection, and a get of the last key-to-be-set # on a separate connection, to demonstrate that the connection pool is working properly. def parallel_test(host, key_base) c = MemcachedClient::Client.connect(host, logg...
class AddSomeIndexesToPosts < ActiveRecord::Migration def change add_index :posts, :creator_id add_index :posts, :published_at end end
class Range def rand conv = (Integer === self.end && Integer === self.begin ? :to_i : :to_f) ((Kernel.rand * (self.end - self.begin)) + self.begin).send(conv) end end class Object def alert(msg) dialog = Gtk::MessageDialog.new( app.win, Gtk::Dialog::MODAL, Gtk::MessageDialog::IN...
require('minitest/autorun') require('minitest/reporters') require_relative('../pub.rb') require_relative('../drink.rb') require_relative('../customer.rb') require_relative('../food.rb') Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new class PubTest < MiniTest::Test def setup() @pub = Pub.new("Win...
class CreateIctHardwareBookings < ActiveRecord::Migration def self.up create_table :ict_hardware_bookings do |t| t.references :booker t.references :department t.references :facility_ict t.string :application_category t.timestamps end end def self.down drop_table :ict_har...
require 'test_helper' class ContextRulesControllerTest < ActionController::TestCase setup do @context_rule = context_rules(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:context_rules) end test "should get new" do get :new assert_res...
class CreateHospitals < ActiveRecord::Migration def change create_table :hospitals do |t| t.string :hospital_id t.text :name t.text :address t.float :lat t.float :lng t.string :report_full t.integer :wait_see t.integer :wait_push_bed t.integer :wait_bed ...
class TasksController < ApplicationController before_action :set_task, only:[:show, :edit, :update, :destroy] before_action :login_check PER = 10 # def index # if params[:task] && params[:task][:search] # 検索の場合 # end def index if params[:sort_by_deadline] # 期限順 @tasks = current_user.task...
class Scategory < ActiveRecord::Base belongs_to :shop has_many :articles accepts_nested_attributes_for :articles end
CarrierWave.configure do |config| config.cache_dir = "#{Rails.root}/tmp/uploads" if Rails.env.production? config.fog_credentials = { :provider => 'AWS', # required :aws_access_key_id => 'AKIAJATKGAWCCDNFZN6Q', # required ...
require 'spec_helper' describe IoJob do describe "process" do before :each do @job = IoJob.new end it "should take more than two seconds to run" do @job.process delta = @job.ended_at - @job.started_at delta.should be > 2 end end end
module Guidelines class Tag attr_accessor :itemprop, :body, :parent, :children, :valid, :current_parent def initialize(body) raise 'There is no body!' if !body self.body = body self.itemprop = body.attribute('itemprop').value if body.attribute('itemprop').to_s self.valid = fal...
class MQController # include Formatter def initialize params @params = params end def index users = User.all users.each_with_index do |user, i| puts "#{i+1}. #{user.name}" end end def create user = User.new(params[:user]) if user.save puts "Success!" else put...
class Catalog < ApplicationRecord #association has_many :areas, dependent: :destroy #validate validates_presence_of :name end
# encoding: UTF-8 require 'spec_helper' describe 'jenkins_utils::default' do let(:chef_run) do ChefSpec::Runner.new do |node| node.set[:runit][:sv_bin] = '/usr/bin/sv' end.converge(described_recipe) end it 'includes master recipe' do expect(chef_run).to include_recipe('jenkins_utils::master') ...
# Calculate the fuel cost and travel time puts "Welcome to the Trip Calculator" puts "" # The menu screen def splash print "Please choose the metric calculation (km/miles)... " metric = gets().chomp() if metric != "km" && metric != "miles" splash() end print "What is the travel distance (#{ metric })? ...
ActiveAdmin.register AdminUser do before_action :require_admin permit_params :name, :contacts, :email, :role, :password, :password_confirmation index do selectable_column id_column column :name column :email column :role column :contacts column :created_at actions end filter ...
class RenameRestrictionTable < ActiveRecord::Migration[5.2] def change rename_table :restrictions, :restriction_types end end
class AddTheVisitIdToModels < ActiveRecord::Migration def up add_column :proposals, :visit_id, :uuid add_column :comments, :visit_id, :uuid add_column :reports, :visit_id, :uuid add_foreign_key :proposals, :visits add_foreign_key :comments, :visits add_foreign_key :reports, :visits end de...
class PostsController < ApplicationController # GET /posts # GET /posts.json def index if current_user @id = current_user.id @posts = Post.where(user_id: @id) respond_to do |format| format.html # index.html.erb format.json { render json: @posts } end end end def create @p...
class Equipement < ApplicationRecord has_many :exercices has_many :my_equipements has_many :users, through: :my_equipements end
class ChangeCustomerIdInPayments < ActiveRecord::Migration[5.1] def change remove_column :payments, :user_id, :integer add_column :payments, :customer_id, :integer remove_column :payments, :status add_column :payments, :status, :string end end
# Source: https://launchschool.com/exercises/860cfef1 def include?(arr, val) arr.map { |x| x == val ? 1 : 0 }.sum > 0 end # LS suggeston: use !!array.find_index(value) # Remember: double bang (!!) converts value to its boolean form p include?([1,2,3,4,5], 3) == true p include?([1,2,3,4,5], 6) == false p include?([...
require_relative '../../../../spec_helper' describe 'govuk::app', :type => :define do let(:title) { 'giraffe' } context 'with no params' do it do expect { is_expected.to contain_file('/var/apps/giraffe') }.to raise_error(Puppet::Error, /Must pass app_type/) end end context 'with g...
# # Sous-class Thing::Item # # Un item d'une Thing # class Thing class Item # ------------------------------------------------------------------- # Classe # ------------------------------------------------------------------- # => Return true si les données contenues dans +data+ (Hash) sont ...
# frozen_string_literal: true class VideoCategoriesFinder < BaseFinder include Sortable include Filterable include Paginatable AVAILABLE_FILTERING_KEYS = %i[name].freeze AVAILABLE_SORTING_KEYS = %w[created_at -created_at].freeze end
require 'sinatra' require 'octokit' require 'yaml' require 'logger' require_relative 'lib/command' class SlackCommander < Sinatra::Base set :bind, '0.0.0.0' configure do set :dump_errors, false set :show_exceptions, false end def validate_command! halt 403 unless params['token'] == ENV['SLACK_TO...
# frozen_string_literal: true class AppearanceBroadcastJob < ApplicationJob queue_as :default def perform(_user) users = User.all ActionCable .server .broadcast('appearance_channel', user: users) end private def render_json(user) ApplicationController.renderer.rend...
#!/usr/bin/ruby # # CFNDSL DSL Rake build written by AWS Professional Services for x require 'cfndsl/rake_task' $purpose = "BWFL" $stringtime = Time.new.inspect $lambda_dir = '../lambda-functions' $policy_dir = "../iam-policies" $ssmdoc_dir = "../ssm-documents" CfnDsl::RakeTask.new('default') do |t| t.cfndsl_opts...
class Project < ApplicationRecord has_many :user_projects has_many :users, through: :user_projects has_many :comments, as: :commentable, dependent: :destroy has_many :reactions, as: :reactable, dependent: :destroy belongs_to :category validates :name, length: { minimum: 2 } validates :description, length...
# # Nucleotide Count # # DNA is represented by an alphabet of the following symbols: 'A', 'C', 'G', and 'T'. # # Each symbol represents a nucleotide, which is a fancy name for the particular molecules that happen to make up a large part of DNA. # # So back to DNA. # # Write a program that will tell you how many times e...
# frozen_string_literal: false require_relative "rss-testcase" require "rss/1.0" require "rss/dublincore" module RSS class TestParser10 < TestCase def test_RDF assert_ns("", RDF::URI) do Parser.parse(<<-EOR) #{make_xmldecl} <RDF/> EOR end assert_ns("", RDF::URI) do Parser.pars...
require 'spec_helper' describe Itrp::Export::Monitor::Mail do before(:each) do @export_mail = Itrp::Export::Monitor::Mail.new(::Mail.new(File.read("#{@fixture_dir}/export_finished_1.eml"))) @non_export_mail = Itrp::Export::Monitor::Mail.new(::Mail.new(File.read("#{@fixture_dir}/non_export.eml"))) @on_pre...
require_relative "ruby_perf/version" require_relative "ruby_perf/parser" require_relative "ruby_perf/test" require_relative "ruby_perf/create_csv" require_relative "ruby_perf/generate_graphs" module RubyPerf def self.execute_test(test_paramaters) low_rate = test_paramaters.fetch(:low_rate) high_rate = test_p...
require 'test_helper' class TextHelperTest < ActionView::TestCase def setup @controller = Class.new do attr_accessor :request def url_for(*args) "http://www.example.com" end end.new end def test_simple_format_with_escaping_html_options assert_dom_equal(%(<p class="intro">It's nice to ha...
# Run the code in this file by typing: # ruby 4.rb # into your command-line interface. myself = {name: "Janice", location: "Chicago", status: "hanging out in class"} # puts myself my_profile = { name: "J-nice", location: { city: "Chicago", neighborhood: "Wicker", state: "IL" }, ...
class VendingMachineAdvanced puts "This Vending Machine contains 4 Items ['Pepsi','Fanta','Coke','Marinda'] to dispense" puts "Load vending machine with item Quantity:" $items = ["Pepsi","Fanta","Coke","Marinda"] $quantity = [] $prices = [8,12,15,20] $coins = {1 => 0, 2 => 0, 5 => 0,10 => 0} $items.each do |i...
class AnnouncementCommentPolicy < ApplicationPolicy def permitted_attributes [ :body, :sender_id, :announcement_id ] end def create? record.sender == user end end
require 'spec_helper' describe 'LD4L::OreRDF::FindAggregations' do describe "#call" do context "when repository is empty" do before do ActiveTriples::Repositories.add_repository :default, RDF::Repository.new end it "should return an empty array" do aggregations = LD4L::OreRDF:...
# frozen_string_literal: true class SchedulesController < ApplicationController include AgendaEagerLoading include SchedulePaginationHelper before_action :find_agenda before_action :ensure_not_processing, :ensure_schedules_present, only: :index before_action :ensure_processing, only: :proces...
Vagrant.configure("2") do |config| config.vm.define "master.vm" do |master| master.vm.box = "centos/7" master.vm.hostname = "master.vm" master.vm.provision "shell", path: "scripts/masterbootstrap.sh" master.vm.network "private_network", ip: "192.168.55.4" master.vm.provider "virtualbox" do |v| ...
require "csv" class Parser::Csv < Parser::Parser def records Enumerator.new do |y| csv = CSV.new(io_from_file(@filename), headers: headers) csv.each do |row| record = row.map { |k,v| [k.downcase.strip.gsub(/[^a-z0-9]+/, "_").to_sym, (v || "").gsub(/[^[[:ascii:]]]/, "").strip] }.to_h r...
module OrderedActiveRecord def self.included(base) base.class_eval do def self.acts_as_ordered(column = :position, options = {}) before_create do reorder_positions(column, send(column), true, options) end before_destroy do reorder_positions(column, send("#{column...
class Rolodex attr_reader :contacts def initialize @contacts = [] @id = 1000 end def add_contact(contact) contact.id = @id @contacts << contact @id += 1 end def find(contact_id) @contacts.find {|contact| contact.id == contact_id} end #This find method belongs to Ruby Enumerable module. I...
class Parser DELIMITER = ',' def self.split string string.split(DELIMITER) end end
module Domain class Card def self.create(id:, title:, text:, state:, board_id:) Events::Card::Created.new(id:, title:, text:, state:, board_id:) end def initialize(id:, title:, text:, state:, board_id:) @id = id @title = title @text = text @state = state @board_id = bo...
module Sluggable extend ActiveSupport::Concern included do extend FriendlyId validates :slug, { :uniqueness => true, :presence => true, :length => { :in => 3..100 }, :exclusion => {in: Shortline.const.reserved_slugs} } end end