text
stringlengths
10
2.61M
# frozen_string_literal: true module Kafka class TransactionStateMachine class InvalidTransitionError < StandardError; end class InvalidStateError < StandardError; end STATES = [ UNINITIALIZED = :uninitialized, READY = :ready, IN_TRANSACTION = :in_tras...
require_relative '03_associatable' module Associatable def has_one_through(name, through_name, source_name) define_method(name) do self.send(through_name).send(source_name) end end end
require "acts_as_shareable_object/active_record/acts/shareable_object" require "acts_as_shareable_object/action_view/shareable_object/view_helpers" module ActsAsShareableObject if defined?(Rails::Railtie) class Railtie < Rails::Railtie initializer 'acts_as_shareable_object.include_in_active_record' do ...
module SimpleCov module ArrayMergeHelper # Merges an array of coverage results with self def merge_resultset(array) new_array = dup array.each_with_index do |element, i| if element.nil? && new_array[i].nil? new_array[i] = nil else local_value = element || 0 ...
module Fog module Compute class DigitalOceanV2 # noinspection RubyStringKeysInHashInspection class Real def delete_ssh_key(id) request( :expects => [204], :headers => { 'Content-Type' => "application/json; charset=UTF-8", }, ...
require 'digest/md5' require 'feed2email/migrate/migration' module Feed2Email module Migrate class SplitHistoryMigration < Migration private def applicable? super && pending? end def feed_history_path(feed_uri) root.join("history-#{Digest::MD5.hexdigest(feed_uri)}.yml") ...
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" default_box = "realreadme/amazon2016.09" virtual_machines = [ { name: "muaha", forwarded_ports: [ ], files: [ {:src => "bin/muahaha", :dst => "/tmp/muahaha"} ], provisioners: [ ...
require 'http' require 'jwe' module MyInfo class Api # endpoint method name ENDPOINT = { person_basic: 'person-basic', authorise: 'authorise', token: 'token', person: 'person' }.freeze attr_accessor :realm, :app_id, :client_id, :singpass_eservice_id, :mode, :private_key, :bas...
class V1::GamesController < V1::ApiController before_filter :find_record, only: [:show, :update, :destroy] before_filter :preprocess_params, only: [:create, :update] def create @game = Game.create game_params if @game.persisted? render_200 else render_400(@game.errors.full_messages) e...
class ApplicationController < ActionController::Base include SessionsHelper before_filter :signed_in_user protect_from_forgery rescue_from CanCan::AccessDenied do |exception| redirect_to root_path, :alert => exception.message end def add_breadcrumb(name, url = '') @breadcrumbs ||= [] url = s...
require_relative '../commands' require 'dry-validation' class Commands::InitBitmap def initialize(state: nil, args: [1, 1]) @m = args.first.to_i @n = args.last.to_i validate! @state = Array.new(@n){ Array.new(@m, 'O') } end def run @state end private def validate! validation_resu...
require "ips_validator/version" require 'ips_validator/loader' require 'ips_validator/validator' module IpsValidator class Runner class << self def run(args) num_valid = 0 num_invalid = 0 num_error = 0 total = 0 puts "\n" statuses = [] ...
#encoding: utf-8 class EventMailer < ActionMailer::Base add_template_helper(ApplicationHelper) default from: APP_DATA["email"]["from"]["normal"] # 活动明天举行 def event_hold_tomorrow(email, event, participant = '') subject = "您报名参加的#{event.title}活动明天就要举办了" @event = event @participant = participant m...
module ApiErrorHelper def error_for(code, error_object, type = nil) error!({ errors: error_message_for(type, error_object) }, code) end def error_message_for(type, error_object) case type when :record_invalid invalid_record_error_message error_object when :grape_validation_error ...
class SetDefaultTimeZoneOnLocations < ActiveRecord::Migration[5.0] def change change_column :locations, :time_zone, :string, :default => 'UTC' end end
require_relative './array' module AttrHistory def attr_historized(*attributes) Array.wrap(attributes).each do |attribute| method_key = "_#{attribute}s" store_key = "@_#{method_key}" define_method(method_key) do attrs = instance_variable_get(store_key) attrs || instance_variabl...
class HomeController < ApplicationController def index if user_signed_in? begin appointments = Appointment.find(current_user[:id]) rescue ActiveRecord::RecordNotFound => e appointments = nil end end end end
# == Schema Information # # Table name: shortened_urls # # id :bigint(8) not null, primary key # short_url :string not null # long_url :string not null # user_id :integer not null # class ShortenedUrl < ApplicationRecord validates :short_url, :long_url, :user_id, pr...
class GroupChatChannel < ApplicationCable::Channel def subscribed stream_from "group_chat_channel_#{params[:room_id]}" end def speak(msg) begin membership = GroupChatMembership.find_by_group_chat_room_id_and_user_id(msg['room_id'], msg['user_id']) raise ServiceError.new(:NotFound) if membersh...
class CreateTryouts < ActiveRecord::Migration[5.0] def change create_table :tryouts do |t| t.integer :player_id t.integer :coach_id t.string :season t.integer :age_level t.integer :tryout_number t.integer :player_height t.string :player_position t.integer :passing ...
class AddLocationToAdvertisement < ActiveRecord::Migration def change add_column :advertisements, :location, :string, :after => :youtube_videoid add_column :advertisements, :latitude, :float, :after => :location add_column :advertisements, :longitude, :float, :after => :latitude add_column :advertisem...
# encoding: utf-8 require File.expand_path("../spec_helper", __FILE__) not_compliant_on :watir do describe "<frame> Frames" do before :each do browser.goto(WatirSpec.files + "/frames.html") end describe "#length" do it "returns the correct number of frames" do browser.frames.length....
class ConnectionsController < ApplicationController before_action :lookup_target_user, only: [:create, :update] before_action :authenticate_user! def index if current_user @users_to_view = User.all.sample(5) @followers = current_user.followed_by @targets = current_user.following else ...
# frozen_string_literal: true module Robots module DorRepo module Accession class EndAccession < LyberCore::Robot def initialize super('accessionWF', 'end-accession') end def perform_work current_version = object_client.version.current # Search for th...
require 'runit/testcase' require 'runit/cui/testrunner' require 'timerholder' class TimerHolderTest < RUNIT::TestCase def do_test(timeout, keeper_sleep = nil) holder = TimerHolder.new(timeout) holder.keeper_sleep = keeper_sleep if keeper_sleep key = holder.add(self) sleep(timeout * 0.5) assert_eq...
# frozen_string_literal: true module ActiveAny module Reflection class BelongsToReflection < AssociationReflection def association_class Associations::BelongsToAssociation end def macro :belongs_to end def belongs_to? true end private de...
require 'spec_helper' describe ItaOfficeLocationData do let(:fixtures_dir) { "#{Rails.root}/spec/fixtures/ita_office_locations" } let(:resources_dir) { "#{File.dirname(__FILE__)}/ita_office_location" } let(:resource) { [resources_dir + '/odo.yaml', resources_dir + '/oio.yaml'] } let(:importer) { described_clas...
# frozen_string_literal: true require "rails_helper" RSpec.describe Arclight::Repository do describe "#contact_info" do it "returns an HTML safe string" do repository = described_class.all.first expect(repository.contact_info).to be_html_safe end end end
class UserProjectsController < ApplicationController def edit_user_project_permission up = UserProject.find_by(id: user_project_params[:id]) up.permission = user_project_params[:permission] up.save redirect_to edit_project_path(user_project_params[:project_id]) end private def user_project_para...
require 'pathname' class Static attr_reader :app def initialize(app) @app = app end def call(env) req = Rack::Request.new(env) if req.path =~ Regexp.new("^/public/.+$") res = Rack::Response.new parent_dir = File.expand_path("..",File.dirname(__FILE__)) path = Pathname.new(File.j...
=begin The #{} literal is the operator used for interpolation inside double-quoted strings the same way that the backticks or $() construct would be used in Bash. From a practical point of view, the expression inside the literal is evaluated, and then the entire #{} expression (including both the operator and the expr...
class AddAdSize < ActiveRecord::Migration def self.up add_column :ads, :size, :string, :default => "oob" add_index :ads, :size Ad.find(:all).each{|a| a.save} end def self.down remove_index :ads, :size remove_column :ads, :size end end
require 'csv' namespace :purge do desc "Purge all signs" task signs: :environment do puts Sign.where(category: 'Blå').delete_all end end namespace :import do desc "Import all signs" task signs: :environment do CSV.foreach("lib/static_data/signs20131010.csv", col_sep: ',', headers: true) do |row| ...
require 'lita/mailgun_dropped_rate_repository' describe Lita::MailgunDroppedRateRepository do let(:redis) { double(Redis::Namespace) } let(:repository) { Lita::MailgunDroppedRateRepository.new(redis) } before do allow(redis).to receive(:rpush) allow(redis).to receive(:ltrim) allow(redis).to receive(...
# frozen_string_literal: true require 'common/client/base' require 'common/client/concerns/mhv_session_based_client' require 'sm/client_session' require 'sm/configuration' module SM class Client < Common::Client::Base include Common::Client::MHVSessionBasedClient configuration SM::Configuration client_...
class Member < ActiveRecord::Base validates :studentid, presence: true, format: { with: /\A[0-9]+\z/ }, length: {is: 9} validates :email, uniqueness: true validates :studentid, uniqueness: true before_validation :fixStudentId def fixStudentId self.studentid = self.studentid[1..self.studentid.length] if self....
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "PuppetDashApi" do include Rack::Test::Methods def app @app ||= MyApp.new end it "should return hello world when the root route is called" do get '/' last_response.status.should == 200 last_response.body.should == ...
describe Guess do subject(:guess) { described_class.new(value: 'h') } context 'when a guess is correct' do it 'is identified as such' do expect(guess.correct?(['h'])).to be true end end context 'when a guess is incorrect' do it 'is identified as such' do expect(guess.correct?(['a'])).to...
class Website::Page::GroceriesLandingPage < Website::Base set_url "#{Website::Site.instance.url}/groceries" set_url_matcher /groceries/ element :search_box, "#searchBox-1" element :search_button, "input#searchBtn" elements :retrieved_product_grid, "div.productLists ul li" elements :list_products_in_basket, "ul...
class Article < ActiveRecord::Base validates :title, presence: true, length: {minimum:5, maximum:20} validates :descriptions, presence: true, length: {minimum:25, maximum:250} end
class SearchesController < ApplicationController include HTTParty base_uri 'https://api.magicthegathering.io/v1/cards?' def new @search = Search.new @color_collection = Color.all end def show @search = Search.find(params[:id]) end def create @search = Search.new(search_params) Color...
class Round < ApplicationRecord belongs_to :player has_many :scores has_many :doubles end
class BowlingGame attr_reader :score def initialize @score = 0 end def roll times @score += times end end
module LibrarySubjsHelper def extra_libraries(library_subj) # Any extra libraries for the list of libraries? libraries = Array.new UbPub::Application.config.extra_libraries.each do |library| if library_subj.themes.index(library).present? libraries.push (LibraryCat.find_by lib_code: library...
class GameSeat include Mongoid::Document field :seat_no, type: Integer field :player_id, type: String field :chips_at_beginning, type: Integer field :chips_at_hand, type: Integer field :last_bet, type: Integer field :status, type: Integer # embedded_in :sng_game_scene end
require 'minitest/autorun' require_relative 'bank_account' class PhraseTest < MiniTest::Unit::TestCase def test_starting_balance_no_arguments bankAccount = BankAccount.new starting_balance = 0 assert_equal starting_balance, bankAccount.balance end def test_starting_balance_string_argument bankAccount...
class User < ActiveRecord::Base include FacebookIntegrated include ProjectOwnership include ProjectMembership include ProjectSharing include NotificationRecipient include ContactDataFinder include FriendshipSystem include Invitable devise :database_authenticatable, :registerable, :recovera...
class MichalCell < Apotomo::StatefulWidget transition :from => :sober, :to => :drinking transition :in => :drinking def display jump_to_state :sober end def sober @beers = 0 render end def drinking @beers += 1 render end end
FactoryGirl.define do factory :page do sequence :slug do |n| "great-page-#{n}" end title 'Great page' content 'Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy readings from it, Captain' end end
class DevelopController < ApplicationController skip_before_filter :admin_authorize before_filter :authenticate def index @develop = ReleaseFile.paginate(page: params[:page]).order(:created_at) end def upload @release_file=ReleaseFile.new if uploaded_path=@release_file.upload(params) File...
# frozen_string_literal: true require 'rails_helper' require 'sidekiq/testing' Sidekiq::Testing.fake! RSpec.describe EVSS::DisabilityCompensationForm::SubmitForm526, type: :job do before(:each) do Sidekiq::Worker.clear_all end let(:user) { FactoryBot.create(:user, :loa3) } let(:auth_headers) do EVSS:...
require 'test_helper' class BidTest < ActiveSupport::TestCase def setup @bid = bids(:one) @other_bid = bids(:two) end test "should be valid" do assert @bid.valid? end test "should have all required information" do @test = Bid.new assert_not @test.valid? @test.name = "Biddy T...
class Mark attr_accessor :marks_data, :last_updated def initialize(args) self.marks_data = args.delete(:marks_data) self.last_updated = args.delete(:last_updated) end def self.user_sending_updated_data?(current_user, last_updated) (current_user.last_updated.nil? || current_user.last_updated ...
class OperationsEndpoints def self.[](name) all[name] end def self.all @all_resources ||= resources.each_with_object(HashWithIndifferentAccess.new) { |resource, hash| hash[resource.name] = resource.href } end def self.keys all.keys end private def self.service_descriptor @service_des...
def assert(predicate) if not predicate raise "Assert failure" end end schools_hash = [ { name: 'Harvard', communities: [ { name: 'Eliot House' }, { name: 'Lowell House' }, { name: 'Test House' }, { name: "Dhruv's Housizzle" }, ...
class AddSampleIdAndCompanyIdToMedicineInternalRecords < ActiveRecord::Migration[5.0] def change add_column :medicine_internal_records, :sample_id, :integer add_column :medicine_internal_records, :company_id, :integer end end
# frozen_string_literal: true require 'rails_helper' RSpec.describe GameEngine do include_context 'with cache' include(CacheHelper) let(:left) { create(:user) } let(:right) { create(:user) } let(:game) { create(:game, player_left: left, player_right: right) } let(:ge) { GameEngine.new(game, 0) } it 'con...
class SessionsController < Devise::SessionsController # POST /auth/google_apps/callback def create if user = User.find_or_create_by_auth_hash(request.env['omniauth.auth']) sign_in(:user, user) session[:user_id] = user.id end redirect_to :root end # POST /auth/google_apps/android def...
class AddImageToScreens < ActiveRecord::Migration def change add_attachment :screens, :location_image end end
class CocktailService def initialize(query) @query = query end def response conn.get end def url "https://www.thecocktaildb.com/api/json/v1/1/search.php?s=#{@query}" end private def conn Faraday.new(url: url) end end
describe package('mc') do it { should be_installed } end
if ['solo', 'app_master', 'app'].include?(node[:instance_role]) # copy mime.types file remote_file "/etc/nginx/mime.types" do owner node[:owner_name] group node[:owner_name] mode 0755 source "mime.types" backup false action :create end # reload nginx service "nginx" do supports ...
module Api module V1 class HourResource < JSONAPI::Resource attributes :project, :rate, :date, :total_hours, :description belongs_to :project # belongs_to :rate # has_one :client, through: :project # has_one :user, through: :client end end end
class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? helper_method :current_user_can_edit? helper_method :user_can_subscribe? helper_method :user_can_add_photo? def configure_permitted_parameters ...
# Write a method, match_maker, which will receive an unknown number of # elements, and return an array where every two elements are represented by true or false. # # The very first parameter will not be part of this set. Instead, it will tell # you how to determine what their value should be. # If it is true, then they...
class AssembliesController < ApplicationController def edit @assembly = Assembly.find(params[:id]) @article = Article.find(@assembly.article_id) @product = Product.find(@assembly.product_id) end def update @assembly = Assembly.find(params[:id]) @product = Product.find(params[:product_id]) ...
class Temperature # TODO: your code goes here! def initialize(degrees) @f = degrees[:f] @c = degrees[:c] end def in_celsius @f.nil? ? @c : (@f - 32) * 5 / 9.0 end def in_fahrenheit @c.nil? ? @f : (@c * 9 / 5.0) + 32 end def self.from_celsius(degrees) self.new(c: degrees) end ...
class AddDefaultValueToColumnsInAddOns < ActiveRecord::Migration[5.1] def change change_column_default :add_ons, :price_per_unit_cents, 0 change_column_default :add_ons, :total_cents, 0 end end
require 'spec_helper' require 'rails_helper' describe VendorsController do describe "#home" do render_views it "renders the about template" do expect(session[:vendor_id]).to be_nil v = Vendor.create :name => "thai" , :uid => "54321", :provider => "amazon" v.history = "+++++April 3rd, 2...
require_relative '../commands' require 'dry-validation' class Commands::PaintPixel def initialize(state:, args:) @state = state.to_a @x = args[0].to_i @y = args[1].to_i @colour = args[2].to_s validate! end def run() @state[@y-1][@x-1] = @colour @state end private def validate...
require 'telegram/bot' module Telegram module Utils module KeyboardBuilder class << self def keyboard buttons btnClass = Telegram::Bot::Types::KeyboardButton kbClass = Telegram::Bot::Types::ReplyKeyboardMarkup build :keyboard, buttons, btnClass, kbClass end ...
#require 'graphviz' class GraphMap def initialize #@step_skip = [] @step_attributes = {} @link_attributes = {} @step_history = [] @link_history = [] @steps = [] @links = [] end def prepare(with_timestamp = false) # Build new graph @g = GraphViz::new("G", :rankdir => "LR", :...
require 'bikecontainer' shared_examples_for "bike container" do let(:container) {described_class.new} describe '#bike_in' do let (:bike) {double(:bike)} it 'adds bike to van' do bike_count = container.bikes.count container.bike_in(bike) expect(container.bikes.count).to eq bike_count + 1 ...
class Cached::ArticlesController < ApplicationController inherit_resources respond_to :json defaults resource_class: Cached::Article, collection_name: 'cached_articles', instance_name: 'cached_article' before_filter :load_article, only: [:show, :update, :edit, :destroy] def load_from_source source = So...
# Problem 228: Minkowski Sums # http://projecteuler.net/problem=228 # Let Sn be the regular n-sided polygon – or shape – whose vertices # # vk (k = 1,2,…,n) have coordinates: # # xk   =   # cos( 2k-1/n×180° ) # # yk   =   # sin( 2k-1/n×180° ) # Each Sn is to be interpreted as a filled s...
require 'spec_helper' describe DefaultTimeOptions do before do @options = {} end it 'defaults to 1 month ago floored and now floored with a monthly time_period' do Timecop.freeze do DefaultTimeOptions.set(@options) @options[:start_time].class.should eq ActiveSupport::TimeWithZone @opt...
class Stock < ActiveRecord::Base belongs_to :user belongs_to :item validates :user_id, presence: true validates :item_id, presence: true validates :user_id, uniqueness: { scope: :item_id } validate :user_cannot_stock_self_posted_item def user_cannot_stock_self_posted_item item = Item.find item_id ...
class SupplyTeachers::AuditSpreadsheet include TelephoneNumberHelper def to_xlsx package = Axlsx::Package.new workbook = package.workbook add_branch_worksheet(workbook) add_rate_worksheet(workbook) package.to_stream.read end private def add_branch_worksheet(workbook) workbook.add_wo...
json.dams @dams do |dam| json.id dam.id json.name dam.name json.water_releases dam.water_releases.today_and_future do |wr| json.date wr.date.strftime("%b %e") json.generation wr.generation if wr.generation json.start_at wr.start_at.strftime("%b %e, %l:%M %p") json.stop_at wr.stop_at.strfti...
class ChangeArticleStringFieldsToText < ActiveRecord::Migration def change change_column :articles, :headline, :text change_column :articles, :deck, :text change_column :articles, :slug, :text end end
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
class UpcomingVideogameRelease::Game include Creatable::InstanceMethods extend Findable::ClassMethods extend Creatable::ClassMethods attr_accessor :name, :release_date, :genre, :console @@all = [] def initialize(name) self.name = name self.console = [] self.genre = [] end def display p...
Given("I am on the home page") do visit('/') end Given("I search for {string}") do |string| fill_in 'search_form_input_homepage', with: string click_on('search_button_homepage') end Then("I will hopefully see {string} in my search results") do |string| expect(page).to have_content(string) end
#!/usr/bin/ruby def error(msg) STDERR.puts msg exit 1 end if ARGV.length < 2 error "Usage: #{File.basename $0} <input_file> <OUTPUT_FILE or DIR> [type]" end input_file=ARGV[0] output_path=ARGV[1] type=ARGV[2]||'pdf' unless File.exist? input_file error "INPUT FILE #{input_file} is not exists!" end unless Fi...
# == Schema Information # # Table name: requests # # id :bigint not null, primary key # comments :text # request_items :jsonb # status :integer default("pending") # created_at :datetime not null # updated_at :datetime not null # distribu...
class AddRecipeIdToSubMenu < ActiveRecord::Migration def change add_column :sub_menus, :recipe_id, :integer end end
class User < ApplicationRecord validates :name, :email, presence: true validates :email, uniqueness: {case_sensitive: false} has_many :pet_projects, class_name: "Project", foreign_key: "owner_id" has_many :assignments, dependent: :destroy has_many :projects, through: :assignments has_many :notes, dependent:...
require 'spec_helper' describe Chanko do shared_examples_for 'updating load' do after do Object.send(:remove_const, 'ChankoDummy') rescue nil ActiveSupport::Dependencies.reset_timestamps_and_defined_classes end it 'should raise if missing related file is required' do expect { r...
module TokenAuthenticatable extend ActiveSupport::Concern included do skip_before_action :verify_signed_out_user, only: :destroy, if: :devise_controller? before_action :authenticate_user_from_token! before_action :verify_signed_out_user_with_token end # 使用 user.authentication_token 来进行认证 # # @sampl...
class Student attr_accessor :id, :name, :grade def self.new_from_db(row) # takes a row from the database and creates a new Student object new_student = self.new new_student.id = row[0] new_student.name = row[1] new_student.grade = row[2] new_student end def self.all # retrieves all rows fr...
class MealsController < ApplicationController def index @meals = Meal.all render json: @meals end # GET /mods/1 def show set_meal render json: { meal: @meal, ingredients: @meal.ingredients } end private # Use callbacks to sh...
class AddTripConstraints < ActiveRecord::Migration def change change_column :trips, :dayNumber, :integer, :null => false change_column :trips, :startDate, :date, :null => false add_index :trips, [:user_id, :startDate] end end
# This migration comes from inkwell (originally 20130212130878) class ChangeCommunityTableForAddingTypesAndUserAccess < ActiveRecord::Migration def change if ::Inkwell::Engine.config.respond_to?('community_table') add_column ::Inkwell::Engine.config.community_table, :default_user_access, :string, default: '...
class Lesson < ActiveRecord::Base has_many :adjectives has_many :verbs has_many :nouns def as_json(options = {}) adjective = Adjective.take(3) super(options.merge(include: :adjectives)) end end
class Destination < ApplicationRecord validates :destination_first_name, presence: true, format: { with: /\A[ぁ-んァ-ン一-龥]/, message: 'は全角で入力してください。' } validates :destination_family_name, presence: true, format: { with: /\A[ぁ-んァ-ン一-龥]/, message: 'は全角で入力してください。' } validates :destination_first_name_kana, presence: tr...
# Application Mailer class ApplicationMailer < ActionMailer::Base default from: 'noreply@blernswar.com' layout 'mailer' @url = 'http://localhost:3000/' end
# convert a string to an integer without using built-ins. DECIMAL = 10 DIGITS = { '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, 'a' => 10, 'b' => 11, 'c' => 12, 'd' => 13, 'e' => 14, 'f' => 15 } def string_to_integer(string, base = DECIMAL) number = 0 ...
class Genre < ActiveRecord::Base validates :title, :presence => true, :uniqueness => true has_many :classifications , :class_name => "Classification", :foreign_key => "genre_id", :dependent => :destroy has_many :books, :through => :classifications end
module RunPal class ShowUserWallet < UseCase def run(inputs) inputs[:user_id] = inputs[:user_id].to_i user = RunPal.db.get_user(inputs[:user_id]) return failure(:user_does_not_exist) if user.nil? wallet = RunPal.db.get_wallet_by_userid(inputs[:user_id]) return failure(:wallet_does...
class User < ActiveRecord::Base has_and_belongs_to_many :seminars has_many :comments end