text
stringlengths
10
2.61M
class ProductsController < ApplicationController before_action :authenticate_vendor!, only: [:new, :create, :edit, :update] before_action :set_product, only: [:show, :edit, :update, :destroy] before_action :set_vendor, only: [:index, :new] def index @products = @vendor.products.limit(10) end def show @vendo...
class Item def initialize(t) @records_with_tax = t end def self.generate_input(input) data = [] if input.to_i == 1 data = [ { name: 'Book', price: 12.49, taxable: false, imported: false, quantity: 1 }, { ...
require 'rails_helper' feature 'Create answer', %q( In order to answer to the question As an authenticated user I want to be able to create an answer on the question page ) do given(:user) { create(:user) } given(:question) { create(:question) } scenario 'Authenticated user creates an answer' do sign...
class Admin::AdbackendsController < ApplicationController layout "admin/admin" before_filter :admin_login_required before_filter :set_ad_admin_active def index @adbackends = Adbackend.find(:all) end def show @adbackend = Adbackend.find(params[:id]) end def new @adbackend = Adbackend...
require('minitest/autorun') require_relative('../models/league') require_relative('../models/match') require_relative('../models/team') class TestLeague < MiniTest::Test def setup team1 = Team.new({'name' => "Rubyists", 'location' => 'Edinburgh'}) team2 = Team.new({'name' => "Java Scriptors", 'location' => ...
class Recipe < ActiveRecord::Base validates_presence_of :name, :ingredients, :steps def pretty_steps step_out = "" steps.split(".").each_with_index { |step, step_num| step_out += "#{step_num+1}: #{step}\n"} return step_out end def to_s "#{name}\nIngredients: #{ingredients.split(",")}\nSteps:\n#{pretty_s...
class Course < ActiveRecord::Base extend CourseRepository has_many :classroom, dependent: :restrict_with_exception validates :name, presence: true, length: { maximum: 45 } validates :description, presence: true, length: { maximum: 45 } end
require 'spec_helper' describe 'postfix::master' do let(:title) do 'submission/inet' end let(:params) do { command: 'smtpd', private: 'n', chroot: 'n', } end on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end it {...
#=============================================================================== # CP Scan - Picture Addon # by DrDhoom # v1.0a - 9-22-14 #=============================================================================== module Dhoom module CPScan #True : Use battler picture, False : Use picture in Pictures fo...
class OfflineGroupCategory < GroupCategoryLancer has_many :service_provider_member has_many :offline_categories def self.optgroup result = Array.new self.active_only.all.each do |online_group_category| result << [online_group_category.name_display, OfflineCategory.select_list(online_group_category...
class CreateRoles < ActiveRecord::Migration[5.2] def change create_table :roles do |t| t.string :title t.text :description t.string :permission_create t.string :permission_view t.string :permission_update t.string :permission_delete t.string :permission_send_notifications...
require 'rails_helper' RSpec.describe List, type: :model do let(:user) { create(:user) } let(:list) { create(:list, user: user) } it { is_expected.to belong_to(:user) } it { is_expected.to have_many(:items).dependent(:destroy) } it { is_expected.to validate_presence_of(:title)} describe "attributes" do ...
class Libmd < Package desc "This library provides message digest functions found on BSD systems" homepage "https://www.hadrons.org/software/libmd/" url "https://archive.hadrons.org/software/libmd/libmd-${version}.tar.xz" release version: '1.0.0', crystax_version: 1 build_copy 'COPYING' def build_for_abi...
class TeamParticipation < ActiveRecord::Base default_scope where("active = ?", true) ROLES = %w(captain first_team reserve) belongs_to :user belongs_to :team validates :role, :presence => true, :inclusion => { :in => 0...ROLES.size } def role_name if role < ROLES.size then ROLES[role] ...
require 'spec/spec_helper' require 'maws/connection' require 'maws/instance' describe 'Instance' do it "creates subclasses for different services" do Instance.new_for_service(:ec2,'ec2-instance1', nil, nil, {}, {}, {}).should be_a_kind_of(Instance::EC2) Instance.new_for_service(:rds,'rds-instance1', nil, nil...
require 'spec_helper' module Polidea::Artifacts describe Processor do let(:processor) { Processor.new('') } context "processing Android artifacts" do let(:artifact_paths) {["spec/res/PodsTest.apk"]} context 'Android using basic processing' do it "should add manifest file to artifacts" do ...
require 'monitor' require 'base64' require 'rdebug/base' require 'vocabularise/model' module VocabulariSe class Cache MAX_CHUNK_SIZE = 5000 TIMEOUT_SHORT = :short TIMEOUT_NORMAL = :normal TIMEOUT_LONG = :long def initialize min, max @timeout = { TIMEOUT_SHORT => min, TIMEOUT_NORMAL => Math....
# 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...
require 'tempfile' module Rendering class GraphVizUI def initialize(path) @path = path end def render(graph) if graph.nil? || graph.empty? raise 'Graph cannot be empty' end file = write_graph_to_file(graph) system("dot -Tpng #{file.path} -o #{@path}") file....
module GroupBuzz class MarkdownHelper def self.link(link, title, content) "[#{content}](#{link})" end def self.image(link, title, content) "![#{content}](#{link}#{title})" end def self.underline(text) "_#{text}_" end def self.emphasis(text) "*#{text}*" end ...
Fabricator(:equipment) do name { sequence(:name) { "equipment#{i}" } } description { Faker::Lorem.sentences(3) } pic "MyString" start_available "2014-09-17 17:24:37" end_available "2014-09-18 17:24:37" end
# -*- encoding : utf-8 -*- class AddStatusToDevices < ActiveRecord::Migration def change add_column :devices, :status, :string, :default => "offline" add_column :devices, :channels, :string, :default => "" end end
class Round < ActiveRecord::Base belongs_to :competition has_many :matches accepts_nested_attributes_for :matches, :allow_destroy => true def name if round_name.present? round_name else "#{number}. #{I18n.t('matches.round_robin_round')}" end end end
require 'hop_converter' describe HopConverter do # tests for cases where the hop_converter array consists of the same number it 'converts [1, 1] to left2 left2' do hop_converter = HopConverter.new([1, 1]) expect(hop_converter.output).to eq 'left2 left2' end it 'converts [1, 1, 1, 1] to left4 left4 lef...
require "uri" require "net/http" require "json" require "colorize" module Sourcebin $base_url = "https://sourceb.in/" $domain = $base_url.gsub("https://","").gsub('/','') def self.write(name = "file.rb",code) url = URI($base_url + "/api/bins") form = { files: [name: name, content: code, languageId: 3...
require 'csv' require 'erb' class Person attr_reader "name", "phone", "address", "position", "salary", "slack", "github" def initialize(name, phone, address, position, salary, slack, github) @name = name @phone = phone @address = address @position = position @salary = salary @slack = slack...
# encoding: utf-8 ### # to run use # ruby -I ./lib -I ./test test/test_rss.rb # or better # rake test require 'helper' class TestHypertextHelper < Minitest::Test include TextUtils::HypertextHelper # lets us use textify, etc. def test_strip_tags ## empty tags assert_equal '', strip_tags( '...
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :name, :limit => 32, :null => false t.string :email, :limit => 32, :null => false t.string :salt, :limit => 8, :null => false t.string :encrypted_password, :limit => 16, :null => false t.datet...
require_relative 'spec_helper' require "pry" describe "Trip class" do describe "initialize" do before do start_time = Time.parse('2015-05-20T12:14:00+00:00') end_time = start_time + 25 * 60 # 25 minutes @trip_data = { id: 8, passenger: RideShare::User.new(id: 1, ...
class Statistic include DataMapper::Resource property :id, Serial property :attention, Integer, :default=>0 # raw views, to be refined property :nixcount, Integer, :default=>0 # nix count property :firstlasttimeratio, Float property :mood_x, Integer, :default=>10 pro...
class WelcomeController < ApplicationController def index @news = Post.all.order('id DESC') end end
# @author Kristian Mandrup module TroleGroups class Operations module Write # Test role_groups equality # @param [Array<Symbol>] role_groups list to test def == *role_groups rolegroup_subject.rolegroup_list == role_groups.to_symbols_uniq end alias_method :equal, :"==" ...
# frozen_string_literal: true # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including withou...
require 'rails_helper' RSpec.describe FacilitiesManagement::ProcurementBuildingsController, type: :controller do let(:procurement_building) { create(:facilities_management_procurement_building, procurement: create(:facilities_management_procurement, user: subject.current_user)) } describe 'GET #show' do conte...
# ============================================================================ # Examples of classes using Ruby --- January 2017 class Animal # attr_reader :name # def initialize(name_0) @name = name_0 # "@...": instance variable, @@animalnb += 1 # "@@...": static ......... end ...
require 'rails_helper' RSpec.describe SupplyTeachers::Journey::AgencyPayroll, type: :model do subject(:step) do described_class.new( postcode: postcode, term: SupplyTeachers::Term.all.first, job_type: SupplyTeachers::JobType.roles.first ) end let(:model_key) { 'activemodel.errors.model...
# -*- mode: ruby -*- # vi: set ft=ruby : require 'json' appConfig = JSON.parse(File.read('config.json')) nodes = appConfig['nodes'] Vagrant.configure('2') do |config| nodes.each do |node| config.vm.define node['name'] do |config| envFile = '.env.' + node['name'] f = File.new(envFi...
require 'fox16' require_relative 'scraper' # needed to be able to grab from book_list require 'open-uri' include Fox class InfoLayout < FXGroupBox def initialize(p, title, book) super(p, "Book Details", :opts => GROUPBOX_TITLE_CENTER | LAYOUT_EXPLICIT | FRAME_RIDGE, x: 610, width: 590...
class Manager::ApplicationController < ::ApplicationController before_filter -> { @_theme = :back_end } before_filter :verify_manager def current_ability @current_ability ||= Ability.new(current_user, current_store) end protected def verify_manager redirect_to store_url unless current_user end ...
require "active_support/core_ext/class/attribute_accessors" require "active_support/core_ext/string/inflections" require "graphql_server/instrumentation/field" module GraphQLServer module FieldResolutionRouter class Error < StandardError; end def self.call(type, field, obj, args, ctx) FieldResolver.ne...
# frozen_string_literal: true class PrivateController < ApplicationController layout 'private' before_action :authenticate_user! before_action :set_private_raven_context if Rails.env.production? rescue_from CanCan::AccessDenied do |_| raise ActionController::RoutingError, 'Not Found' end private de...
Pod::Spec.new do |s| s.name = "SBDynamicWaterNode" s.version = "1.0.1" s.summary = "Physical water simulation for SpriteKit" s.description = <<-DESC Physical water simulation for SpriteKit with demo application DESC s.homepage = "https://gith...
# frozen_string_literal: true module BPS module PDF class Receipt module PolicyLinks # This module defines no public methods. def _; end private def policy_links(_payment) policy_links_left policy_links_right end def policy_links_left ...
class ItemsController < ApplicationController def index @items = Item.all @new_item = Item.new end def update @items = Item.all @item = Item.find(params[:id]) if @item.update_attributes(item_params) respond_to do |format| format.js format.html { redirect_to items_path } end else r...
class AddRecommendationToOrders < ActiveRecord::Migration def change add_column :orders, :recommendation, :string end end
class Ballot < ActiveRecord::Base belongs_to :voter has_many :ballotEntries, dependent: :destroy obfuscate_id :spin => 32767 def eql?(other) self.ballotEntries.eql? other.ballotEntries end def to_array return ballotEntries.inject([]) do |result, entry| result << en...
module Manipulacao class InsercaoLegenda attr_reader :texto, :margem, :topo, :fonte extend NamedParameter def self.factory(legenda) fonte = legenda[:fonte].clone fonte[:tamanho] = fonte[:tamanho].to_i margem = legenda[:margem].to_i topo = legenda[:topo] if topo.is_a? Stri...
require './TreeNode.rb' class KnightPathFinder def initialize(pos) @move_tree = build_move_tree(pos) end #TODO if you are ever bored: make shift for TreeNode then use the root treenode as the queue def build_move_tree(pos) root = TreeNode.new(pos) queue = [root] visited_positions = {root.value ...
require_relative 'contact' require 'pry' # Interfaces between a user and their contact list. Reads from and writes to standard I/O. class ContactList # TODO: Implement user interaction. This should be the only file where you use `puts` and `gets`. input_array = ARGV case ARGV[0] when "new" puts "P...
#!/usr/bin/env ruby # 2x2 Matrix Determinant Calculator # by Dmitry Kudriavtsev usage = "Usage: #{$0} <a> <b> <c> <d>" abort usage if ARGV.length != 4 args = ARGV.map {|i| i.to_f} a, b, c, d = *args det = a * d - b * c puts det
class DownloadImage def initialize(url) @url = url end def file @file ||= begin file = nil options = {use_ssl: @url.scheme == "https", open_timeout: 5, read_timeout: 30} Net::HTTP.start(@url.host, @url.port, options) do |http| http.request_get(@url.request_uri) do |response| ...
# == Schema Information # # Table name: kits # # id :bigint not null, primary key # active :boolean default(TRUE) # name :string not null # value_in_cents :integer default(0) # visible_to_partners :boolean default(TRUE...
class FontPlemolJpNfj < Formula version "1.4.0" sha256 "dee4c8a153057381cff90eb61091ed47b6a42f457a13243f0ab0b7f141d81dbf" url "https://github.com/yuru7/PlemolJP/releases/download/v#{version}/PlemolJP_NFJ_v#{version}.zip" desc "PlemolJP NF" desc "Japanese programming font synthesized from IBM Plex Mono and IBM...
require 'test_helper' class PollTest < ActiveSupport::TestCase test 'test that poll has an owner' do poll = polls(:one) assert_equal 'MyString', poll.owner end test 'test that poll has a number of choices' do poll = polls(:one) assert_equal 1, poll.choices end test 'test that poll has a quest...
mysql_user = attribute('mysqlUser', default: 'mysql', description: 'Name of mysql User') mysql_password = attribute('mysqlPassword', default: 'root', description: 'Password of mysql User') mysql_ipAddress = attribute('mysqlAddress', default: '127.0.0.1', description: 'Ip address of mysql') control "mysql--admin-pr...
class CreateSoldItems < ActiveRecord::Migration def self.up create_table :sold_items do |t| t.references :store_item t.references :invoice t.integer :quantity t.string :code t.string :invoice_type t.decimal :rate, :precision =>15, :scale => 2 t.timestamps end end ...
class AddActiveToSurveyResponses < ActiveRecord::Migration[5.1] def change add_column :survey_responses, :active, :boolean, null: false, default: true end end
class Account < ActiveRecord::Base with_options :presence => :true do |model| model.validates :email, :uniqueness => true, :format => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :length => { :maximum => 256 } model.validates :password, :confirmation => true, :length => { :minimum => 8, :maximum => 256 } m...
describe "proposals" do include EnvVarSpecHelper include ReturnToHelper describe "DISABLE_CLIENT_SLUGS" do it "disallows any request for disabled client_slug" do with_env_var("DISABLE_CLIENT_SLUGS", "foo") do allow(Proposal).to receive(:client_slugs).and_return(%w(foo)) proposal = creat...
require 'simplecov' SimpleCov.start require 'rubygems' require 'bundler/setup' require 'webmock/rspec' require 'timecop' require 'vcr' require 'active_support/all' WebMock.disable_net_connect! VCR.configure do |config| config.cassette_library_dir = 'spec/fixtures/vcr_cassettes' config.filter_sensitive_data('<POM...
module HTTPalooza module Players class RestClientPlayer < Base introducing! :rest_client, %w[ rest_client ] def response response = RestClient::Request.execute( :method => request.method, :url => request.url.to_s, :payload => request.payload, :headers =...
class RegionsController < ApplicationController include RedirectCallback before_action :set_callback, only: [:index] after_action :clear_callback, only: [:set] def set cookies[:region_id] = { :value => params[:region_id], :expires => 1.year.from_now, :httponly => true } redirect...
class TaskOrdersController < ApplicationController # GET /task_orders # GET /task_orders.json def index @current_game = Game.where(current: 1).first @task_orders = TaskOrder.where(game_id: @current_game) @teams = Team.where(confirm: true) respond_to do |format| format.html # index.html.erb ...
require "rake" require "rake/clean" require "rake/gempackagetask" require "rake/rdoctask" require "fileutils" include FileUtils PROJECTS = %w{sequel_core sequel} def with_each_project PROJECTS.each do |p| FileUtils.cd(p) begin yield p ensure FileUtils.cd('..') end end end def sh_with...
# Encoding: utf-8 require 'spec_helper' pam = OHAI['etc']['pam'] describe 'Pam Configuration Plugin' do it 'should be a Mash' do expect(pam).to be_a(Mash) end it 'should have a value' do expect(pam.keys).not_to be_empty end end
class VirtualCategory attr_reader :id, :designation def initialize(id:, designation:) @id, @designation = id, designation end end
require 'test/unit' require 'estimator' # The current tests come from the implementation at # https://github.com/odo/quantile_estimator class QuantileEstimatorTest < Test::Unit::TestCase def test_biased_with_uniform_distribution invariant = Invariant::Biased.new(0.00001) estimator = Estimator.new(invariant...
class AddAttachmentImageheadToPost < ActiveRecord::Migration def self.up add_column :posts, :imagehead_file_name, :string add_column :posts, :imagehead_content_type, :string add_column :posts, :imagehead_file_size, :integer add_column :posts, :imagehead_updated_at, :datetime end def self.down ...
# Modify the method from the previous exercise so it ignores non-alphabetic characters when determining whether it should uppercase or lowercase each letter. The non-alphabetic characters should still be included in the return value; they just don't count when toggling the desired case. =begin idea: - solution for p...
namespace :db do desc "Import delicious links from delicious-cli" task import: :environment do links = Path["~/.delicious/delicious.marshal"].parse # { # "href"=>"http://www.math-atlas.org/", # "hash"=>"62c3de9eb43e751f4cc8a90176088855", # "description"=>"Mathematical Atlas: A gateway ...
# # Module qui specifie les details du format, textuel, pour la base de # donnees, notamment, les separateurs, le format exact pour la # lecture/ecriture dans le fichier. # module CoursTexte # Separateur pour les champs d'un enregistrement specificant un cours. SEPARATEUR = ',' SEP = SEPARATEUR # Un alias pour ...
ActiveAdmin.register AssignGroupPlace do permit_params :place_id index do selectable_column id_column column :place_order column :place actions end csv do column :id column :place_order column :place end form do |f| order = f.object.place_order places = Place.usa...
module CDI module V1 class SimpleQuestionUserAnswerSerializer < ActiveModel::Serializer root false attributes :id, :question_id, :user_id, :answer_index, :answer_text, :created_at, :updated_at end end end
class AddDurationToVideofxes < ActiveRecord::Migration def change add_column :videofxes, :duration, :string, limit: 10 add_column :videofxes, :resolution, :string, limit: 10 add_column :videofxes, :looped_video, :string, limit: 10 add_column :videofxes, :alpha_channel, :string, limit: 10 add_colum...
class UsersController < ApplicationController def index @users = User.order('lower(name)').all @sub_title = 'User list' respond_to do |format| format.html { render :layout => suggested_layout } format.json { render :json => {:users => @users.as_json(:request => request, :skip_root => true)} ...
class ApplicationController < ActionController::Base protect_from_forgery helper_method :get_song, :get_song_id, :get_category def get_song(cat) song = Song.find_by_category_id(cat) if song.blank? return '' else song.title end end def get_song_id(cat) # @songs = Song.where(...
# The UserController#create is not been used! It's the DeviseRegistration instead class UsersController < InheritedResources::Base load_and_authorize_resource skip_authorize_resource :only => [:create, :update, :validate_email, :create_password, :sign_in] skip_before_action :verify_authenticity_token, only: [:cr...
# == Schema Information # # Table name: users # # id :integer not null, primary key # activated :boolean default(FALSE) # activated_at :datetime # activation_digest :string # admin :boolean default(FALSE) # email :string not ...
module ClinkCloud class DataCenter < Base attribute :id attribute :name def group_id @group_id ||= links.select { |l| true if l['rel'] == 'group' }.first['id'] rescue # This happends when accessing group_id on an object # sculpted from within a collection. Need to use .find to ...
#!/usr/bin/ruby -w srand 42 class Array def sorted_include? o a, b = o !!bsearch { |(x, y)| c = a - x c.zero? ? b - y : c } end end class GameOfLife delta = [-1, 0, 1] same = [0, 0] DELTAS = (delta.product(delta) - [same]).sort MIN = { true => 2, false => 3 } @@neigh...
class Position attr_accessor :x, :y def initialize(x, y) @x = x @y = y end def +(count) forward = @y + count @x = @x + forward / 10 @y = forward % 10 self end end
class CreateProfile < ActiveRecord::Migration def change create_table :profiles do |t| t.string :phone t.string :country t.string :city t.integer :zipcode t.string :line1 t.string :line2 t.string :url_gravatar t.references :user, index: true end e...
class AddHoralIdToAtividades < ActiveRecord::Migration def self.up add_column :atividades, :hora, :datetime end def self.down remove_column :atividades, :hora end end
require_relative '../../rubyhome/errors/errors' module RubyHome class DayParser attr_accessor :weekdays, :weekends # all names and variations thereof that this class can match on. def names { :monday => 'monday, mon', :tuesday=> 'tuesday, tue', :wednesday=> 'w...
# frozen_string_literal: true class Address < ApplicationRecord include Uuidable belongs_to :addressable, polymorphic: true validates :address1, presence: true after_save :set_primary, if: :primary_changed_to_true? def full_address "#{address1}, #{address2}, #{city}, #{state}".gsub(', ,', ',') end ...
class Building attr_accessor :address, :sqft, :no_of_stories, :apartments def initialize(options={}) @address= options[:address] @sqft = options[:sqft] @no_of_stories = options[:no_of_stories] @apartments = {} end def total_income apt_cost_array = apartments.map do |apartment_key, apartment...
require "json" require "jani/from_json/movie" require "jani/from_json/banner" require "jani/from_json/strip" require "jani/from_json/tracking_event" class Jani::FromJson::Builder attr_accessor :json_data def initialize(json_data: {}.to_s) @json_data = json_data end def new_movie Jani::FromJson::Movie...
class ProductsController < ApplicationController respond_to :html before_filter :find_all_products, except: [:create, :destroy, :update, :show] def index respond_with(@products) end def show @product = Product.find(params[:id]) respond_with(@product) end protected def find_all_products ...
# 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...
FactoryGirl.define do factory :round_category, class: 'RoundCategory' do category { create :category, :with_questions } round_questions { build_list :round_question, 3 } end end
class AddHighestScoreToRating < ActiveRecord::Migration def change add_column :ratings, :highest_score, :float end end
module Backup module Configuration class Storage extend Backup::Configuration::Attributes generate_attributes %w(ip user password path access_key_id secret_access_key host use_ssl bucket username api_key container) end end end
class LocationController < ApplicationController # Endpoint to fetch all Food Truck matches based on a street address # GET location/index def index if params["query"] # Geocode a street address or place into [lat,long] coordinates = Geocoder.coordinates(params["query"]) # Dont bother se...
class InvoiceItem < ApplicationRecord scope :not_shipped, -> { where.not(status: :shipped) } enum status: { pending: 0, packaged: 1, shipped: 2 } belongs_to :invoice belongs_to :item validates :quantity, presence: true validates :unit_price, presence: true validates :status, presence: true def self....
class CompraMedicamentos attr_accessor :id, :created_on, :afiliado_id, :monto, :costo_final def initialize(afiliado_id, monto) @afiliado_id = afiliado_id @monto = monto end end
# frozen_string_literal: true class Layer < ApplicationRecord belongs_to :category has_many :view_layers, dependent: :destroy has_many :views, through: :view_layers validates :name, presence: true, uniqueness: true validates :url, presence: true delegate :maptype, to: :category def full_url catego...
=begin #Rakam API Documentation #An analytics platform API that lets you create your own analytics services. OpenAPI spec version: 0.5 Contact: contact@rakam.io Generated by: https://github.com/swagger-api/swagger-codegen.git Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file e...
class ScalesController < ApplicationController def search type = params[:scale_type] scale = Scale.find_by_key(type) assets = scale ? Scale.with_scale(scale) : everything_with_scale resource_hash={} assets.each do |res| resource_hash[res.class.name] = {:items => [], :hidden_count => 0} un...
class TournamentMembership < ApplicationRecord belongs_to :user belongs_to :tournament def next_match self.tournament.next_match_of(self.user) end def completed? self.status == "completed" end def defeated? !self.tournament.scorecards.where(user_id: self.user_id, result: "lose").empty? en...
# frozen_string_literal: true require 'friendship_methods' class UsersController < ApplicationController include FriendshipMethods before_action :authenticate_user! def show @user = User.find(params[:id]) @recent_posts = @user.posts @mutual_friendships = Friendship.where(user_id: current_user, confir...