text
stringlengths
10
2.61M
require "rails_helper" feature "Image details" do scenario "Show details of image", :vcr do visit "/" click_link "hello-world", match: :first expect(page).to have_content "Namespace" expect(page).to have_content "/" expect(page).to have_content "Image" expect(page).to have_content "hello-wo...
# typed: true # frozen_string_literal: true module Packwerk module Checker extend T::Sig extend T::Helpers interface! sig { returns(ViolationType).abstract } def violation_type; end sig { params(reference: Reference).returns(T::Boolean).abstract } def invalid_reference?(reference); end...
DirectionAndAngle = Struct.new(:dir, :angle) E = DirectionAndAngle.new('E', 0) N = DirectionAndAngle.new('N', Math::PI/2) W = DirectionAndAngle.new('W', Math::PI) S = DirectionAndAngle.new('S', Math::PI*3/2) DirectionHash = {'N' => N, 'E' => E, 'S' => S, 'W' => W} class Rotator def initialize(initial_direction = ...
#Include this in items to make them automatically be deleted after a specified time. module Expires def initialize *args super end def run super if info.expiration_time and Time.now.to_i > info.expiration_time expire end end def expire_in seconds info.expiration_time = (Time.now + ...
class Special # database find_all def self.find_all tag = Tag.find_by_name(tag_name) return [] if tag.blank? Appointment.public.recurring.all(:joins => :tags, :conditions => ["tags.id = ?", tag.id]) end # database find_by_city def self.find_by_city(city, options={}) return [] if city.blank? ...
require 'test_helper' class Cms::StoresControllerTest < ActionDispatch::IntegrationTest setup do @cms_store = cms_stores(:one) end test "should get index" do get cms_stores_url assert_response :success end test "should get new" do get new_cms_store_url assert_response :success end ...
require 'rails_helper' RSpec.describe 'Verticals' do let(:user) { create :user } let(:token) { token_for(user.username, 'password') } let!(:verticals_list) { create_list :vertical, 20 } let(:vertical) { verticals_list.first } it 'paginates the stored verticals' do api_get '/verticals', token: token ...
require 'byebug' class Code POSSIBLE_PEGS = { "R" => :red, "G" => :green, "B" => :blue, "Y" => :yellow } def self.valid_pegs?(arr) arr.all? { |ele| POSSIBLE_PEGS.has_key?(ele.upcase) } end attr_reader :pegs def self.random(num) rgby = "RGBY".split('') Code.new(Array.new(num) ...
module Gossiper module Concerns module Models module Notification extend ActiveSupport::Concern STATUSES = %w(pending delivered) included do serialize :data, JSON validates :kind, presence: true belongs_to :user, polymorphic: true end ...
class Location < ActiveRecord::Base validates :name, :zip, presence: true validates :zip, length: { is: 5 } belongs_to :user end
module Decidim module Participations module Admin # This controller allows admins to answer participations in a participatory process. class CopyParticipationsController < Decidim::Admin::Features::CustomBaseController helper_method :participation def create ...
Given(/^I am on the "([^"]*)" page$/) do |page| visit "#{page}.html" end When(/^I press the "([^"]*)" button$/) do |button| click_button button end When(/^I click the "([^"]*)" link$/) do |link| click_link link end When(/^I press the "([^"]*)" button (\d+) times?$/) do |button, n| n.to_i.times { click_button...
require 'rest-client' require 'json' require 'pry' GOOGLE_BOOKS_API_BASE_URL = "https://www.googleapis.com/books/v1/volumes?q=" def welcome_user # welcome user puts "Welcome to our Book Searcher!" end def get_search_terms # ask user for input about search terms puts "What would you like to search for...
class CreateMedias < ActiveRecord::Migration[4.2] def change create_table :medias do |t| t.belongs_to :user t.belongs_to :account t.string :url t.string :file t.string :quote t.string :type t.timestamps null: false end add_index :medias, :url, unique: true end e...
require_relative 'spec_helper' describe 'Solr' do include EventedSpec::SpecHelper include EventedSpec::EMSpec default_timeout 100 before :all do @start_delay = 0 end it 'checks java' do stdin, stdout,stderr = Open3.popen3("java -version") expect(stderr.readlines[0]).to match /java version \"...
class TicketsController < ApplicationController # GET /tickets # GET /tickets.json def index @tickets = Ticket.all respond_to do |format| format.html # index.html.erb format.json { render json: @tickets } end end # GET /tickets/1 # GET /tickets/1.json def show @event = Event....
class Book < ApplicationRecord belongs_to :author validates :title, presence: {message: 'Judul harus diisi'} validates :description, length: {minimum: 10, message: 'Minimal 10 huruf'} validates :page, numericality: {greater_than: 10, message: 'Halaman harus lebih dari 10'} def self.expe...
require "spec_helper" feature "User sessions" do scenario "Unauthenticated users are redirected to sign in page" do visit root_path expect(current_path).to eq(sign_in_path) end scenario "Sign in directs users to the root path" do create(:user, email: "test@example.com", password: "password") vis...
# encoding: UTF-8 # Copyright 2011-2013 innoQ Deutschland GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
# # Cookbook Name:: ruby # Recipe:: default # # Copyright (C) 2012 Mathias Lafeldt <mathias.lafeldt@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
class User < ActiveRecord::Base acts_as_authentic validates_uniqueness_of :email validates_presence_of :email validates_presence_of :crypted_password end
# frozen_string_literal: true # MetaTag Model class MetaTag < ApplicationRecord include ActivityHistory include CloneRecord include Uploadable include Downloadable include Sortable acts_as_list before_save :split_url validates_uniqueness_of :url validates_presence_of :title, :meta_tags, :url def ...
require 'model_test_helper' class RuleTest < ActiveSupport::TestCase # assert_attr_protected test "assert_attr_protected" do assert_attr_protected :name assert_fail_assertion "is_admin is not protected" do assert_attr_protected :is_admin end end test "assert_attr_protected deve ace...
class PacientesController < ApplicationController before_action :set_paciente, only: [:show, :edit, :update, :destroy] # GET /pacientes def index @pacientes = Paciente.all end # GET /pacientes/1 def show end # GET /pacientes/new def new @paciente = Paciente.new end # GET /pacientes/1/e...
class ImdbClient include HTTParty base_uri 'imdb.com' def self.scrape_top_250! chart = Chart.create! chart.transaction do top_250 = fetch_top_250 existing_movies = Movie.select(:id, :imdb_id).where(:imdb_id => top_250.map{|m| m[:imdb_id]}).map{|m| [m.imdb_id, m.id]}.to_h top_250.each ...
class AppointmentNotification::ScheduleExperimentReminders < ApplicationJob queue_as :high class << self prepend SentryHandler end def self.call perform_now end def logger @logger ||= Notification.logger(class: self.class.name) end def perform return unless Flipper.enabled?(:experimen...
class AjaxMessenger attr_accessor :result attr_accessor :message def initialize(message = '', success = true) @message = message @result = success ? 'success' : 'failure' end end
# frozen_string_literal: true require "bundler/gem_tasks" require "rspec/core/rake_task" task :run_specs do require "rspec/core" types_result = RSpec::Core::Runner.run(["spec/dry"]) RSpec.clear_examples Dry::Types.load_extensions(:maybe) ext_result = RSpec::Core::Runner.run(["spec"]) exit [types_result...
class AddColumnsModeyIdAndChangeTipeToProvisions < ActiveRecord::Migration def change add_column :provisions, :money_id, :integer add_column :provisions, :exchange_of_rate, :float end end
require 'mspire/molecular_formula' module Mspire class Isotope module AA # These represent counts for the individual residues (i.e., no extra H # and OH on the ends) aa_to_el_hash = { 'A' => { C: 3, H: 5, O: 1, N: 1, S: 0, P: 0 }, 'C' => { C: 3, H: 5, O: 1, N: 1, S: 1, P: 0 }, ...
class ApplicationController < ActionController::API rescue_from ActiveRecord::RecordNotDestroyed, with: :not_destroyed rescue_from ActiveRecord::RecordNotFound, with: :not_found private def not_destroyed(data) render json: { errors: data.record.errors }, status: :unprocessable_entity end def not_foun...
# == Schema Information # # Table name: messages # # id :bigint(8) not null, primary key # user_id :integer # text :text # data :json # created_at :datetime not null # updated_at :datetime not null # resource_type :string # resource_id :bigint(8)...
# frozen_string_literal: true require "aws-sdk-ssm" require "json" require "link-header-parser" require "logger" require "log_formatter" require "log_formatter/ruby_json_formatter" require "net/https" require "uri" require_relative "ssm_client" class Cleaner attr_reader :asa_token, :log, :instance_id def initia...
class RobotsController < ApplicationController def show render file: Rails.application.root.join("public", "#{Rails.env}_robots.txt"), layout: false, content_type: "text/plain" end end
## Array Addition I # Using the Ruby language, have the function # ArrayAdditionI(arr) take the array of numbers stored in # arr and return the string true if any combination of numbers # in the array can be added up to equal the largest number in # the array, otherwise return the string false. For example: # if arr co...
# frozen_string_literal: true require 'ffi' module Rollenspielsache # Wrapped up string class FFIString < FFI::AutoPointer def self.release Binding.free self end def to_s @to_s ||= read_string.force_encoding('UTF-8') end # Rust externs module Binding extend FFI::Library...
# encoding: utf-8 class CrawlAlbumInfoWorker include Sidekiq::Worker sidekiq_options queue: "lyric" def perform(album_id) album = Album.find(album_id) begin c = LyricCrawler.new c.fetch album.link c.crawl_album_info album.id rescue end end end
class AddFirstTimeMessageToMatches < ActiveRecord::Migration def change add_column :matches, :first_message_time, :datetime end end
class AddDataToPhotos < ActiveRecord::Migration def change add_column :photos, :name, :string add_column :photos, :date_taken, :datetime end end
class Adventure < ActiveRecord::Base has_many :pages belongs_to :library accepts_nested_attributes_for :pages #validates :title, length { minimum: 4 } #validates :author, length { minimum: 3 } # validates :GUID, presence: true, length: { is: 10} end
class CreatePersonalInfos < ActiveRecord::Migration def change create_table :personal_infos do |t| t.string :first_name t.string :last_name t.text :about t.string :tagline_profession t.string :tagline_background t.string :address_1 t.string :address_2 t.string :subu...
class CreateTopFiftyGems < ActiveRecord::Migration def change create_table :top_fifty_gems do |t| t.string :name t.string :version t.string :summary t.string :url t.text :description t.timestamps end end end
require 'spec_helper' resource "Notifications" do let(:user) { users(:owner) } before do log_in user end get "/notifications" do pagination example_request "Get a list of notifications for the current user" do status.should == 200 end end put "/notifications/read" do parameter...
class GFA::RecordSet::SegmentSet < GFA::RecordSet CODE = :S INDEX_FIELD = 2 # Name: Segment name ## # Computes the sum of all individual segment lengths def total_length set.map(&:length).reduce(0, :+) end end
# == Schema Information # # Table name: parkings # # id :integer not null, primary key # user_id :integer # name :string(255) # description :text(65535) # parking_type_id :integer # spaces :integer # address :text(65535) # distri...
# == Schema Information # # Table name: api_keys # # id :integer not null, primary key # access_token :string # created_at :datetime not null # updated_at :datetime not null # require 'rails_helper' RSpec.describe ApiKey, type: :model do describe "#model token creation"...
#!/bin/ruby require 'ocr' reader = OCR::AccountReader.new($stdin) begin reader.each do |account_number| puts account_number.show end rescue OCR::StandardError => ex puts "Error detected on account number starting at line #{ex.line_number}" if ex.line_number puts "Error Message: #{ex.message}" puts "OCR ...
# ## Exo 1 - Le palindrone # Le script Ruby permettra de saisir un mot et de vérifier que ce mot est un palindrome. # Le retour de code se fera comme suit : # Le mot mot saisie est un palindrome # Le mot mot saisie n’est pas un palindrome # je prepare la methode palindrome qui attend une string def palindrome(string) ...
require 'rails_helper' describe 'navigate' do before do @admin_user = FactoryBot.create(:admin_user) login_as(@admin_user, :scope => :user) end describe 'edit' do before do @post = FactoryBot.create(:post) end it 'has a status field that can be edited in the form' do visit edit_...
require 'rails_helper' RSpec.describe Api::V1::FindCustomersController, type: :controller do fixtures :customers describe "#index" do it "finds and serves all customers' json by ID" do get :index, format: :json, id: customers(:customer_1).id expect(response.status).to eq(200) expect(response...
class Product < ApplicationRecord has_many :order_items validates_numericality_of :price validates_numericality_of :stock, :only_integer => true, :greater_than_or_equal_to => 0 def price=(input) input.delete!("$") super end end
require 'spotify_web/assertions' require 'spotify_web/event' require 'spotify_web/loggable' module SpotifyWeb # Represents a callback that's been bound to a particular event # @api private class Handler include Assertions include Loggable # The event this handler is bound to # @return [String] ...
class ServiceStat < ActiveRecord::Base belongs_to :custom belongs_to :station end
class AddIncludesRemixesToGenres < ActiveRecord::Migration def change add_column :genres, :includes_remixes, :boolean, :default => false end end
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_filter :get_hostname_and_port before_filter :get_browser_details def get_hostname_and_port @host = req...
class Debug def self.elapsed(name) puts "Performing #{name}" t = Time.now yield elapsed = (Time.now - t).to_f puts "took #{elapsed} seconds" end end
require 'spec_helper' require 'fog' require 'my_fog_helper' describe Fog do let(:username) { ENV['RAX_USERNAME'] } let(:api_key) { ENV['RAX_API_KEY'] } context "Mock with Fog", :mock => :fog do it "should create a server (Fog.mock!)", :mock => :fog do helper = MyFogHelper.new(username, ap...
class AddTuningIndices < ActiveRecord::Migration @@indices = { 'customers_labels' => :customer_id, 'vouchers' => :showdate_id, } def self.up @@indices.each_pair { |k,v| add_index k, v } end def self.down @@indices.each_pair { |k,v| remove_index k, v } end end
#Note that we are using Postgres and therefore ActiveRecord #we don't define attributes inside the classes but rather in the database tables class User < ActiveRecord::Base # validates_presence_of :email, :password validates_uniqueness_of :email validates_format_of :email, with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z...
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources :posts root 'posts#index' # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". # Y...
require 'spec_helper' describe Acfs::Collection do let(:model) { MyUser } describe 'Pagination' do let(:params) { Hash.new } let!(:collection) { model.all params } subject { Acfs.run; collection } context 'without explicit page parameter' do before do stub_request(:get, 'http://use...
require 'spec_helper' require 'yt/models/claim' describe Yt::Claim do subject(:claim) { Yt::Claim.new data: data } describe '#id' do context 'given fetching a claim returns an id' do let(:data) { {"id"=>"aBcD1EfGHIk"} } it { expect(claim.id).to eq 'aBcD1EfGHIk' } end end describe '#asset_...
require 'test_helper' class CriminalsControllerTest < ActionController::TestCase setup do @criminal = criminals(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:criminals) end test "should get new" do get :new assert_response :success ...
class DoctorPicturesController < ApplicationController before_action :set_doctor_picture def new @picture = DoctorPicture.new end def create @picture = DoctorPicture.new(doctor_picture_params) @picture.doctor = current_doctor if @picture.save flash[:notice] = "Foto guardada." redirect_to current_d...
########################################################################## # Copyright 2022 Thoughtworks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
class SaldoBancarioHistorico < ActiveRecord::Base belongs_to :user belongs_to :saldo_bancario attr_accessible :valor, :valor_cents, :valor_currency, :user_id, :saldo_bancario, :fecha_de_alta monetize :valor_cents, :with_model_currency => :valor_currency validates :user_id, :presence => true validates :sal...
#!/bin/ruby class BotSaves def find_grid(grid, character) element = nil grid.each_with_index{|arr,index| element = [index,arr.index(character)] if arr.include?(character)} element end def displayPathtoPrincess(n,grid) n = n.to_i unless n%2 == 1 return "element should be odd number." ...
class JsonWebToken # Secret to encode/decode token HMAC_SECRET = MyVinylApi::Application.credentials.secret_key_base def self.encode(payload, exp = 24.hours.from_now) # Set expiration to 24 hours from now payload[:exp] = exp.to_i # Sign token with secret JWT.encode(payload, ...
class CreateSavedSearch < ActiveRecord::Migration def change create_table :saved_searches do |t| t.references :user, index: true t.integer :year_min, :year_max t.decimal :price_min, :price_max t.float :length_min, :length_max t.string :length_unit t.string :manufacturer_model ...
class AddColomnNamePhoneToUser < ActiveRecord::Migration def change add_column :users, :name, :string add_column :users, :phone, :string add_column :users, :gender, :string add_column :users, :birth, :datetime add_column :users, :address, :string add_column :users, :level, :integer add_col...
# Use this setup block to configure custom options in SimpleForm. SimpleForm.setup do |config| config.wrappers :wide_horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| b.use :html5 b.use :placeholder b.optional :maxlength b.optional :pattern b.optional :min_max ...
module SwellBot module Routing class RouteSet class RouteCollection def initialize() @collection = [] end def append( pattern, responder, action, options ) @collection << { pattern: pattern, responder: responder, action: action, options: options } self end def merge( route_...
# frozen_string_literal: true require_relative 'output_presenter.rb' class LogParser # It presents the expected output into a more human readable output class TotalVisitsOutputPresenter < OutputPresenter def present output_sorted.map do |key, value| "#{key} #{value} visits" end end ...
class Organisation < ApplicationRecord SERVICE_OWNER_IATI_REFERENCE = "GB-GOV-13" strip_attributes only: [:iati_reference] has_many :users has_many :funds has_many :reports has_many :org_participations has_many :implementing_org_participations, -> { merge(OrgParticipation.implementing).distinct }, ...
class AuthenticationProvider < ActiveRecord::Base has_many :authentication_stats has_many :users, :through => :authentication_stats class << self def [](name) find_by_name name end end end
# The Jak namespace module Jak # The parent Ability class, used to configure scopes to yield for class JakAbility cattr_accessor :yielded_skopes def initialize(resource, &block) @yielded_skopes ||= [] # Indicate what skopes we want included instance_eval(&block) if block_given? end ...
require 'cgi' # unescapeHTML module Plugin::Mastodon::Parser def self.dehtmlize(html) result = html .gsub(%r!</p><p>!) { "\n\n" } .gsub(%r!<span class="ellipsis">([^<]*)</span>!) {|s| $1 + "..." } .gsub(%r!^<p>|</p>|<span class="invisible">[^<]*</span>|</?span[^>]*>!, '') .gsub(/<br[^>]*>...
require 'spec_helper' require 'reverse/polish/suray/operator/operator' describe Operator do describe '#class methods' do describe '#operators' do it 'should include at least one operator' do expect(Operator.operators.length).to be > 0 end end describe '#operator_symbols' do it ...
# PSEUDOCODE # Please write your pseudocode here and keep it commented # INPUT: A string for each of the methods # OUPUT: 1) A Boolean # 2) A String # 3) An Array # What are the steps to solve the problem? Write them out in plain english as best you can. # 1) Check if the string has a pattern that ma...
require "pry" class RotationalCipher LOWER_CASE_ALPHABET = ("a".."z").to_a.freeze UPPER_CASE_ALPHABET = ("A".."Z").to_a.freeze private_constant :LOWER_CASE_ALPHABET, :UPPER_CASE_ALPHABET def self.rotate(...) new(...).rotate end def initialize(input, cipher) @input = input.chars @cipher = ciph...
require 'spec_helper' describe "forum/show.html.erb" do before(:each) do @question = Question.make! render end it "should have Question Title" do rendered.should have_selector("h1", :content => @question.title) end it "should have Question Text" do rendered.should have_selector("div", :id =...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
json.array!(@office_blogs) do |office_blog| json.extract! office_blog, :id, :title json.url office_blog_url(office_blog, format: :json) end
require 'spec_helper' describe "Shopping Cart Requests" do let!(:user) { Fabricate(:user) } let!(:product) { Fabricate(:product, :title => "iPod") } let!(:product2) { Fabricate(:product, :title => "Macbook Pro") } context "when logged in as a normal user" do context "and logged in" do before(:each) ...
include Java java_import Java.hudson.BulkChange java_import Java.hudson.model.listeners.SaveableListener class HelloworldDescriptor < Jenkins::Model::DefaultDescriptor include Jenkins::Model::Descriptor attr_accessor :gname def initialize *a super load end java_signature 'public FormValidation d...
desc 'Setups Google Spreadsheet access' task :setup_google_auth do require 'yaml' require 'signet/oauth_2/client' require "highline/import" say "To use data from Google drive:" say "Create a new project with Google's Developer Platform:" say "<%= color('https://console.developers.google.com/project', :bl...
class CarsController < ApplicationController respond_to :html, :json, :js before_action :set_car, only:[:show, :edit, :update, :destroy] def index if params[:search_for].present? @cars = Car.search_for(params[:search_for]) else @cars = Car.all end end d...
require './lib/db/connect.rb' require './lib/string.rb' require 'uri' require 'digest/sha1' class Peep def self.query(query, db_connection = Connect.initiate(:chitter)) db_connection.exec(query) end def self.keys_and_values @query_keys, @query_values = [], [] end def nth(n) return self[[n.to_i...
# striuct - Struct++ # Copyright (c) 2011-2012 Kenichi Kamiya # @abstract class Striuct class Error < StandardError; end class InvalidOperationError < Error; end end require_relative 'striuct/requirements'
require 'dmtd_vbmapp_data/request_helpers' module DmtdVbmappData # Provides for the retrieving of VB-MAPP Protocol Area information from the VB-MAPP Data Server. class ProtocolArea # @!attribute [r] client # @return [Client] the associated client attr_reader :client # @!attribute [r] area ...
class AddTpaStartEndDatesToAccounts < ActiveRecord::Migration def change add_column :accounts, :tpa_start_date, :date add_column :accounts, :tpa_end_date, :date end end
class User < ApplicationRecord devise :database_authenticatable, :registerable, :omniauthable, :omniauth_providers => [:facebook] validates_presence_of :email, if: :is_not_from_host?, message: 'Емаилот не може да биде празен' validates_presence_of :password,if: :is_not_from_host?, message: 'Лозинката не може да ...
#1 PARA n class Aluno def initialize(nome, ra) @nome = nome @ra = ra end def mostrar_dados puts "Nome: #{@nome}" puts "RA: #{@ra}" end end class Disciplina def initialize(nome) @nome = nome @alunos = [] end def trancar(aluno) # JEITO...
class Board < ApplicationRecord has_many :lists has_many :tasks, through: :lists accepts_nested_attributes_for :lists end
require 'webmock' require 'webmock/rspec' $:.unshift(File.dirname(__FILE__) + '/../lib') require 'imdb' def read_fixture(path) File.read(File.expand_path(File.join(File.dirname(__FILE__), "fixtures", path))) end IMDB_SAMPLES = { "http://www.imdb.com/find?q=Kannethirey+Thondrinal&s=tt" => "search_kannethirey_th...
describe GP do describe "trouver" do context "base de donnees avec plusieurs pieces" do let(:lignes) { IO.readlines("#{REPERTOIRE_TESTS}/piece.txt.2") } let(:attendu) { ['A00001 Info: "INTEL I7" Type : CPU']} it "trouve une piece avec un numero de serie " do avec_fichier '.depot.txt',...
json.array!(@conversations) do |conversation| json.extract! conversation, :theme, :id end
require 'spec_helper' describe Store do it { should validate_presence_of :name } it { should validate_presence_of :token } it { should validate_uniqueness_of :token } end
class AddIdToActorsCategories < ActiveRecord::Migration def change add_column :actors_categories, :id, :primary_key end end
module Offers class GetOffers include Service def initialize(attrs = {}) @params = attrs.fetch(:params) @user = attrs.fetch(:user) end def call #TODO search by ActiveRecord if Elastic is not working Elasticsearch::Search::Offers::GetOffers.new(params: params.merge!(user_id: u...