text
stringlengths
10
2.61M
class SightingsController < ApplicationController def root @sightings = Sighting.all @hash = Gmaps4rails.build_markers(@sightings) do |sighting, marker| marker.lat user.latitude marker.lng user.longitude marker.infowindow sighting.description marker.picture ({ "url" => "/logo.png", "w...
class RouletteService attr_reader :origin_location, :target_location, :character, :main_wound, :subsequent_wounds, :found_items, :healed_wounds attr_accessor :health_after_game def initialize(params, current_character = nil) @origin_location = Location.find(params[:location_id]) @target_location = origin...
module Concerns::Susanoo::Admin::HelpContentAssetsController extend ActiveSupport::Concern included do respond_to :html layout 'filebrowser', only: %i(images attachment_files) # #=== 画像を表示させる # def show @help_image = Susanoo::Assets::HelpAttachmentFile.find(params) send_file(@...
class EditCareerTask < ActiveRecord::Migration def change remove_column :careers, :task_id add_column :careers, :tasks, :text end end
class CartController < ApplicationController def show @cart = current_cart end def add_to_cart current_cart.add_item(params[:product_id]) redirect_to carts_path(current_cart.id) end end
module WebDesignHelper # Return the Bootstrap 4 css classes needed to style a form label def label_classes(*extra_classes) bootstrap_classes = ['col-sm-2', 'col-form-label'] css_classes = [*bootstrap_classes, *extra_classes] css_classes.join(' ') end # Return the Bootstrap 4 css classes needed to s...
# need install dm-sqlite-adapter DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/webtoon.db") class Post include DataMapper::Resource property :id, Serial property :title, String property :img_url, String property :url, String property :score, Float #평균같은 작업해줄때 float로 담아놓는게 편해 property :desc, Str...
class AddPostStatusToBlogs < ActiveRecord::Migration[5.2] def change add_column :blogs, :status, :integer, default: 0 # ^^ NOTE: We manually added the 'default: 0' parameter end end
class CreatePokes < ActiveRecord::Migration[5.0] def change create_table :pokes do |t| t.integer :number t.string :name t.integer :generation t.boolean :acquired t.string :picture t.timestamps end end end
# encoding: utf-8 # # © Copyright 2013 Hewlett-Packard Development Company, L.P. # 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 without limitation the rights #...
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :card do front { Faker::Company.bs } back { Faker::Company.catch_phrase } sequence(:position) { |n| n } end end
class AddQtyToDuplicateStickers < ActiveRecord::Migration def change add_column :duplicate_stickers, :qty, :integer, :default => 0 end end
require 'rails_helper' RSpec.describe Orgadmin::MembershipsController, type: :controller do let(:org) { FactoryGirl.create(:organization) } let(:willy_smith_attr) do { first_name: 'Willy', last_name: 'Smith', email: 'wsmith@gmail.com', membership: { send_email: true } } end before(:each) {...
require 'msf/core' require 'base64' class Metasploit3 < Msf::Exploit::Remote Rank = NormalRanking include Msf::Exploit::Remote::HttpClient def initialize(info = {}) super(update_info(info, 'Name' => 'Sysax Multi Server 5.64 Create Folder BoF', 'Description' => %q...
require 'agilysys_sdk/version' require 'agilysys_sdk/api_client' require 'agilysys_sdk/models/order' require 'agilysys_sdk/models/employee' require 'nokogiri' module AgilysysSdk class AgilysysSdk def initialize(url, client_id, auth_code) @client = AgilysysApiClient.new(url, client_id, auth_code) end ...
class MoveRatingsFromEventsToReviews < ActiveRecord::Migration def self.up add_column :reviews, :rating, :integer events = Event.find(:all, :conditions => ['rating IS NOT NULL'], :order => 'created_at') grouped_events = events.group_by { |event| [event.user_id, event.app_id].join(',') } events...
class Version < ActiveRecord::Base attr_accessible :code_review_insights, :description, :git_hash, :grade, :name, :passed_tests, :patches_deployed, :rbp_open_issues, :tests_coverage def insights code_review_insights.split(';') end def patches patches_deployed.split(';') end end
class ContaController < ApplicationController # GET /conta # GET /conta.json def index @conta = Contum.paginate(page: params[:page]) respond_to do |format| format.html # index.html.erb format.json { render json: @conta } end end # GET /conta/1 # GET /conta/1.json def show @co...
module Ruby module HL7 class QRD < Segment weight 84 add_field :query_date add_field :query_format_code add_field :query_priority add_field :query_id add_field :deferred_response_type add_field :deferred_response_date add_field :quantity_limited_request add_f...
class CommonPagesController < ApplicationController def show username = params[:username] if username[0..2] == "emp" @user = Employee.find_by(username: username) @employeetasks = @user.employee_tasks @quote = Faker::Games::LeagueOfLegends.quote @coworkers = @user.manager.employees - [...
require File.join(File.dirname(__FILE__), 'iis/iis_file_system_path_property') Puppet::Type.newtype(:iis_app) do @doc = "IIS App" ensurable newparam(:name) do desc "App name" newvalues(/.+\/.*/) end newproperty(:applicationpool, :parent => Puppet::IisProperty) do desc "Applicati...
Confy::API.controllers :speakers do include JsonHelper get :index do render_json :'speakers/index.json', locals: { speakers: Speaker.all } end get ":id" do if speaker = Speaker[params[:id]] render_json :'speakers/show.json', locals: { speaker: speaker } else not_found ...
require 'uri' class AffiliateLinker @affiliate def get_affiliate_link(store_name, url, link_id = nil) if @affiliate.nil? || @affiliate.name != store_name @affiliate = Store.find_by_name(store_name) end #find if url contains the store domain if url.include? @affiliate.domain url = pro...
class Relationship < ActiveRecord::Base attr_accessible :pairee_id, :pairer_id, :pairings belongs_to :pairee, :class_name => "ThoughtWorker" belongs_to :pairer, :class_name => "ThoughtWorker" def self.find_pairings(pairee, pairer) Relationship.find_by_pairee_id_and_pairer_id(pairee,pairer) end def se...
class CreateQuestionInputs < ActiveRecord::Migration def change create_table :question_inputs do |t| t.string :question_value t.string :question_comment t.string :regist_user t.string :update_user t.timestamps null: false end end end
class EntryItem < ActiveRecord::Base belongs_to :credit_subject, class_name: 'Subject',foreign_key: 'credit_subject_id' belongs_to :debit_subject, class_name: 'Subject',foreign_key: 'debit_subject_id' validates :entry_date, :explanation, presence:true validates :credit_subject,:debit_subject, presence:true...
require "json" module Cb class EmployeeTypesApi def self.search my_api = Cb::Utils::Api.new() cb_response = my_api.cb_get(Cb.configuration.uri_employee_types) return array_of_objects_from_hash(cb_response) end def self.search_by_host_site(hostsite) my_api = Cb::Utils::Api.new() cb_response ...
require_relative('../db/sql_runner.rb') class Merchant attr_reader(:name, :id) def initialize( options ) @id = options["id"].to_i if options['id'] @name = options["name"] end def save() sql = "INSERT INTO merchants ( name ) VALUES ( $1 ) RETURNING id" valu...
class SendEmailCompletedJobWorker include Sidekiq::Worker def perform(agent_id, job_id) agent = Agent.find(agent_id) job = Job.find(job_id) CustomerMailer.send_job_completed(job.property.customer, job.hashed_id, ENV['FRONTEND_URL']).deliver AgentMailer.send_job_completed(agent, job.hashed_id, ENV['FR...
require 'rails_helper' require 'support/features/helpers' RSpec.feature "UserUpdatesItems", type: :feature do scenario 'item belongs to user' do user = create :user_with_item login_as user visit curb_path click_on 'Edit' fill_in 'Description', with: 'New description' click_button 'Update Item...
require 'Noid' class NoidmanController < ApplicationController before_filter :url_munge before_filter :get_new_noid, :only => [:view, :feed, :dump, :create, :search, :get] before_filter :get_known_noid, :only => [:edit, :delete, :replace] # Using apache mod_auth, since running behind mod_rewrite makes si...
# frozen_string_literal: true require 'styled-yaml' require 'yaml' recipe = { 'name' => StyledYAML.double_quoted(+'Fruit Salad'), 'link' => StyledYAML.single_quoted(+'http://bad.recipes/salad'), 'ingredients' => StyledYAML.inline(%w[apple pear orange]), 'steps' => StyledYAML.literal(+<<~STEPS 1. Dice the ...
require "./entry" class DirEntry < Entry def initialize(name:) @name = name @directory = Array.new end def get_size size = 0 directory.each do |d| size += d.super_class.get_size end end def add(entry:) puts entry.class directory << entry end def ls_entry(prefix:) ...
Rails.application.routes.draw do require 'sidekiq/web' mount Sidekiq::Web => '/sidekiq' resources :users do resources :currencies end root 'base#index' end
require 'spec_helper' feature 'A Scrabble cheater' do scenario 'can visit the homepage' do visit '/' expect(page).to have_content 'Scrabblegram' expect(page).to have_selector '#letters' end scenario 'can enter a string of letters' do visit '/' fill_in 'letters', with: 'spike' fill_in 'n...
# frozen_string_literal: true require 'sodor/stations_builder' require 'sodor/railroad/routes' module Sodor module Railroad RSpec.describe Routes do subject(:router) { described_class } let(:stations) { StationsBuilder.build(sio) } let(:sio) do StringIO.new.tap do |io| line...
require "hub_client/version" require "hub_client/config" require "hub_client/client" require "hub_client/api" require 'hub_client/engine' module HubClient def self.current options={} @current ||= Client.new options end end
class RailMap attr_reader :railroads def initialize (routes) @railroads = [] parse routes end def distance (path) roads = path.split('-') distance = 0 0.upto(roads.size-2) do |index| dis = get_distance(roads[index], roads[index+1]) if (dis == -1) distance = 'No such r...
require "rails_helper" describe "Omniauth" do before do OmniAuth.config.mock_auth[:twitter] = nil Rails.application.env_config['omniauth.auth'] = twitter_mock visit root_path click_on 'Twitterでログイン' end it "ログインできる" do expect(page).to have_content "Twitterでログインしました。" expect(page).to ha...
json.cache! [Api::Public::V1::VERSION, post] do json.id post.obj_key json.title post.to_title json.subtitle post.subtitle json.byline post.byline json.published_at post.published_at json.teaser post.teaser.html_safe json.body post.body.html_safe json.public_url ...
require File.expand_path("../../../base", __FILE__) require "vagrant/util/platform" describe Vagrant::Util::Platform do include_context "unit" subject { described_class } describe "#cygwin?" do before do allow(subject).to receive(:platform).and_return("test") described_class.reset! end ...
require 'yaml' require "support/connection_helpers/redis" require "support/connection_helpers/mongo" require "support/connection_helpers/sequel" require "support/connection_helpers/data_mapper" require "support/connection_helpers/active_record" module ConnectionHelpers SPEC_ROOT = File.join File.dirname(__FILE__), "...
class CreateConversationMessages < ActiveRecord::Migration def change create_table :conversation_messages do |t| t.string :recipients t.string :subject t.text :message_text t.integer :conversation_id t.integer :author_id t.boolean :draft t.timestamps null: false end...
# Given an Array of tuples, where tuple[0] represents a package id, # and tuple[1] represents its dependency, determine the order in which # the packages should be installed. Only packages that have dependencies # will be listed, but all packages from 1..max_id exist. # N.B. this is how `npm` works. # Import any file...
class CommentsController < ApplicationController before_action :logged_in_user def create @comment = current_user.comments.build(post_comment_params) @kickspost = Kickspost.find_by(id: params[:comment][:kickspost_id]) @user = @kickspost.user if @comment.save @comment.create_notice_to_others_...
# frozen_string_literal: true require 'test_helper' module Vedeu module Renderers describe JSON do let(:described) { Vedeu::Renderers::JSON } let(:instance) { described.new(options) } let(:options) { { compression: compression, end_tag: end_tag, ...
class Driver attr_accessor :name @@all = [] #Initializes a new instance of the Driver class (Driver.new("Tony")) and shovels that instance into @@all array def initialize(name) @name = name @@all << self end #Returns an array of all Drivers (Driver.all) def self.all @@all end #Returns...
class Partner class WorkingTime < ApplicationRecord self.table_name = 'working_times' after_initialize :init serialize :repeat, Array belongs_to :partner, class_name: 'Partner', required: false validates :from, :to, :repeat, presence: true def update_by_manual(params) self.from = param...
# CODE REVIEW: Create SEPARATE migrations for each table so it is easier to isolate class CreateTables < ActiveRecord::Migration def change create_table :users do |t| t.string :name, :email, :password_hash t.timestamps end create_table :surveys do |t| t.belongs_to :user t...
require 'rails_helper' RSpec.describe Product, type: :model do # pending "add some examples to (or delete) #{__FILE__}" it 'requires a name' do product = Product.new(name: '') product.valid? expect(product.errors[:name].any?).to eq(true) end it 'requires a pricing' do price = Product.new(price: ''...
require 'rails_helper' RSpec.describe GameOpenQuestion, type: :model do before(:each) do @question = create(:game_open_question) end it 'must be valid' do question = build(:game_open_question) expect(question).to be_valid end it 'must have column indexes' do expect(subject).to have_db_index...
class VouchersController < ApplicationController before_action :set_voucher, only: [:show, :edit, :update, :destroy] # GET /vouchers # GET /vouchers.json def index if !current_user.retailer.nil? @vouchers = Voucher.all.where(retailer_id: current_user.retailer_id) else @vouchers = Voucher.al...
class ManagersController < ApplicationController before_action :find_manager, only: [:show, :edit, :update, :edit_employees, :destroy] skip_before_action :authorized?, only: [:new, :create] def show if @manager.username == session[:user_username] @message_list = @manager.employees @manager_messag...
require 'rails_helper' describe Comment do let(:test_comment) { FactoryGirl.create :comment } it 'has commenter' do expect(test_comment.commenter).to be_truthy end it 'has body' do expect(test_comment.body).to be_truthy end end
require 'active_record' class RestrictionType < ActiveRecord::Base validates :name, uniqueness: true, presence: true end
# frozen_string_literal: true require "timeout" module GraphQL module StaticValidation # Initialized with a {GraphQL::Schema}, then it can validate {GraphQL::Language::Nodes::Documents}s based on that schema. # # By default, it's used by {GraphQL::Query} # # @example Validate a query # vali...
require "csv" class ReadingsExporter HEADERS = [ "timestamp", "temp_inside", "temp_outside", "in_violation", "sensor_id", "address", "zip_code" ].freeze def initialize(params = {}) @filter = params[:filter] @start_time = params[:start_time] @end_time = params[:end_time] ...
=begin PROBLEM: Write a program that manages robot factory settings. When robots come off the factory floor, they have no name. The first time you boot them up, a random name is generated, such as RX837 or BC811. Every once in a while, we need to reset a robot to its factory settings, which means that their name ge...
# #= アプリケーションメーラー # #サインアップ完了通知・招待・プロジェクト召集のメールを送信する。 # class AppMailer < Iso2022jpMailer helper ApplicationHelper # #=== サインアップ完了メールを送信する # # def mail_signup_confirm( user, info ) recipients user.email subject NKF.nkf('-j', info[:subject]) from ActionMailer::Base.smtp_settings[:app_default_f...
require 'tiny_sweeper/brooms' require 'tiny_sweeper/broom_closet' module TinySweeper module ClassMethods def sweep(field_names, *broom_names, &sweeper) Array(field_names).each do |field_name| stop_if_we_have_seen_this_before!(field_name) warn_about_missing_brooms(broom_names) overr...
class Grid attr_accessor :cells attr_accessor :rows, :cols # create empty grid def initialize(rows, cols) @cells = Array.new(rows) @rows = rows @cols = cols 0.upto(rows) do |r| @cells[r] = Array.new(cols) 0.upto(cols) do |c| @cell...
Vagrant::Config.run do |config| config.vm.box = "ubuntu/trusty64" config.vm.host_name = "machine" config.vm.forward_port 80, 8080 config.vm.forward_port 443, 8443 config.vm.provision "ansible" do |ansible| ansible.verbose = "v" ansible.playbook = "playbooks/create_server.yml" ...
Rails.application.routes.draw do resources :books do member do get 'download' end end root to: 'books#index' end
require "digest/md5" require "vanity/experiment/alternative" require "vanity/experiment/bayesian_bandit_score" module Vanity module Experiment # The meat. class AbTest < Base class << self # Convert z-score to probability. def probability(score) score = score.abs pro...
class Api::ImagesController < ApplicationController skip_before_filter :verify_authenticity_token before_filter :authenticate_request! def index render json: {user: current_user_api.email, images: current_user_api.images.select(:id, :file_file_name).map{ |image| image.as_json.merge(link: image.link_download(...
class PhotosController < ApplicationController skip_before_action :authenticate#, only: :index def index render json: Photo.where(profile_id: params[:profile_id]) end def show render json: Photo.where(profile_id: params[:profile_id]).find(params[:id]) end def create profile = Profile.find(par...
=begin Karen West, April 8th, 2013 HW 1-3: Anagrams An anagram is a word obtained by rearranging the letters of another word. For example, "rats", "tars", and "star" are anagrams of one another, as are "dictionary" and "indicatory". We will call any array of single-word anagrams an anagram group. For instance, ["rats...
require 'test_helper' class CityTest < ActiveSupport::TestCase test "the truth" do assert true end test "city must have a name" do city = City.new assert city.invalid? end end
module LinkedResearchMetadata module Transformer # Project transformer # class Project < Base include LinkedResearchMetadata::Transformer::Shared # @param config [Hash] # @option config [String] :url The URL of the Pure host. # @option config [String] :username The username of th...
require 'csv' class BattingPerformance @@records = [] @@teams = CSV.parse(File.read("Teams.csv"), headers: true) def read_data(yearID=nil, teamID=nil) CSV.foreach("Batting.csv", headers: true ) do |row| if yearID && teamID @@records.push(row) if row['yearID'].to_i == yearID.to_i && row['teamID'...
Given "there is a Device" do memorize_fact( :device, Device.create( serial_number: SecureRandom.hex(16), firmware: '1.15.79' ) ) end Given "I am on the main dashboard" do visit('/') login(email, password) end def device recall_fact(:device) end When "I browse to the existing device"...
class UsersController < ApplicationController #POST /users or users_path def create @user = User.new(create_user_params) if @user.save session[:user_id] = @user.id unless session[:user_id] redirect_to root_path else error_messages = @user.errors.full_messages.uniq error_count = ...
class Processor attr_reader :word_hash def initialize(word_hash) @word_hash = word_hash end def process raise NotImplementedError.new("You must implement #process.") end end
class RegistrationsController < Devise::RegistrationsController prepend_before_action :check_captcha, only: [:create] private def check_captcha self.resource ||= resource_class.new sign_up_params unless verify_recaptcha resource.validate # Look for any other validation errors besides reCAPTCHA ...
class AddTotalAndNumberReportingToStudents < ActiveRecord::Migration[5.0] def change add_column :students, :total, :integer add_column :students, :number_in_reporting_districts, :integer end end
class BirdSerializer include FastJsonapi::ObjectSerializer attributes :created_at, :name, :species end
class Rnst < ActiveRecord::Base self.table_name = "rnst" self.primary_key = "rnstid" has_many :frms has_many :sys end
require "test_helper" describe ChallengeProcessor do describe ".perform" do it "expires challenged games that are older than 1 week from the beginning of the day" do travel_to(Time.new(2010, 1, 1)) game = create(:challenge_game) travel_to(Time.new(2010, 1, 10)) ChallengeProcessor.perform...
class FontBigShouldersInlineDisplay < Formula head "https://github.com/google/fonts/raw/main/ofl/bigshouldersinlinedisplay/BigShouldersInlineDisplay%5Bwght%5D.ttf", verified: "github.com/google/fonts/" desc "Big Shoulders Inline Display" desc "Superfamily of condensed American Gothic typefaces" homepage "https:...
class AdminController < ApplicationController before_action :authorized, only: [:auto_login] #creates new admin and JWT token def create admin = Admin.create(admin_params(:first_name, :last_name, :email, :password)) if admin.valid? token = encode_token({admin_id: admin.id}) ...
require "rails_helper" feature "Create a contact message", js: true do include_context "current user signed in" let(:message) { "some message" } let(:expected_mail) { "#{current_user.email}, send #{message}" } scenario "User creates a message" do visit new_contact_path fill_in "Your message", with: ...
# frozen_string_literal: true require 'rails_helper' RSpec.describe BridgeHelper do let!(:cdr) { create(:user, first_name: 'John', last_name: 'Doe') } let!(:com) { create(:user, first_name: 'Jane', last_name: 'Dore') } let!(:stand) { create(:user, first_name: 'Jack', last_name: 'Dodd') } let!(:standing_commit...
require 'pry' class CPU def initialize(instructions, cpu_index, cpu_comms) @instructions = instructions @cpu_index = cpu_index @cpu_comms = cpu_comms @a = 0 @b = 0 @pc = 0 end def run return if @pc >= @instructions.count perform_op @pc += 1 run end private def p...
module ApplicationHelper def full_title(page_title) base_title = "UnBoggle" if page_title.empty? base_title else "#{base_title} | #{page_title}" end end def gravatar_for(user, options = {size: 50}) gravatar_id = Digest::MD5::hexdigest(user.email.downcase) size = options[:siz...
Rails.application.routes.draw do resources :orders do member do get :checkout get :success get :cancel end end root 'orders#index' end # == Route Map # # Prefix Verb URI Pattern Controller#Action # checkout_order GET /orders/:id/checkout(.:format) o...
# encoding: utf-8 module Pakman class Manifest include LogUtils::Logging def initialize() @manifest = [] end def self.load_file_core( old_logger_do_not_use, path ) puts "*** deprecated API call [Pakman::Manifest.load_file_core] - do NOT pass in logger; no longer required/needed; logger arg will ge...
require 'nokogiri' module Providers class Marathon < Base URL_ROOT = 'http://www.marathonbet.com/en/' URL_BETLINES = 'http://www.marathonbet.com/en/betting/%s' URL_ADDITIONAL_LINES = 'http://www.marathonbet.com/en/markets.htm?isHotPrice=false&treeId=%s' def initialize(sport = :soccer) @time_zo...
# frozen_string_literal: true module Api module V1 class RevenueController < ApplicationController def top_merchants integer_check; return if performed? merchants = Merchant.top_merchants_by_revenue(params[:quantity]) render json: MerchantNameRevenueSerializer.new(merchants) ...
require 'concurrent' module ConcurrentIterable class Iterator def initialize(iterable, concurrency: ConcurrentIterable.config.concurrency) @iterable = iterable @concurrency = concurrency @executor = Concurrent::FixedThreadPool.new(concurrency) end def each(&block) iterable.each_s...
# frozen_string_literal: true # Mixin module for base benchmark class exec (and exec helper) commands. module ExecCommands # Helper function used in calculation of number of epochs. def get_last_epoch(benchmark) epoch = nil while epoch.nil? # Epoch can be nil (e.g. if the client is in the "fetchting ...
class Place < ActiveRecord::Base has_many :posts, dependent: :destroy has_many :users has_many :user_groups has_many :users, through: :user_groups end
class CreateBuses < ActiveRecord::Migration def self.up create_table :buses do |t| t.string :name t.string :description t.datetime :departure t.datetime :arrival t.datetime :return t.float :ticket_price t.text :comment t.string :status t.string :direction ...
json.set! :data do json.array! @milestones do |milestone| json.partial! 'milestones/milestone', milestone: milestone json.url " #{link_to 'Show', milestone } #{link_to 'Edit', edit_milestone_path(milestone)} #{link_to 'Destroy', milestone, method: :delete, data: { co...
# encoding: utf-8 require 'set' require_relative 'logger' module DCC class BucketStore include Logger def initialize @buckets = {} @workers_to_projects = {} @projects_to_workers = {} end def set_buckets(project, buckets) @buckets[project] = nil cleanup @buckets[project] = buckets ...
require 'spec_helper' describe Reports::Generators do before :all do @department = Department.create!(name: "Waiters") @department.incomes.create!(spent: 100, created_at: Date.parse("2012-12-27")) @department.incomes.create!(spent: 200, created_at: Date.parse("2013-01-26")) department = Department.c...
require 'sidekiq/web' Rails.application.routes.draw do root 'categories#index' get 'search' => 'links#search', as: :links_search devise_for :users admin_constraint = ->(request) { request.env['warden'].authenticate? && request.env['warden'].user.is_admin } constraints admin_constraint do mount Sideki...
class CreatePointDetails < ActiveRecord::Migration def change create_table :point_details do |t| t.references :point t.references :attribute_type t.string :value t.timestamps null: false end end end
module FacilitiesManagement class Buyer < ApplicationRecord belongs_to :user, foreign_key: :user_id, inverse_of: :buyer end end
class PersonalFunds attr_reader :balance def initialize(balance) @balance = balance end def deduct(amount) self.balance -= amount end def add(amount) self.balance += amount end def balance_in_euros balance / 100.to_f end def zero_balance? balance.zero? end private at...
require 'bcrypt' class Shout include DataMapper::Resource include BCrypt property :id, Serial # unique key property :istop, String # is parent or child, we can eliminate this property :created_at, DateTime # creat...