text
stringlengths
10
2.61M
class CreateThemes < ActiveRecord::Migration def up create_table :themes do |t| t.string :name, limit: 150 t.text :description t.timestamps null: false end end def down drop_table :themes end end
class CategorySerializer < ActiveModel::Serializer attributes :id, :title has_many :items end
class RenameEmailToUsernameToUsers < ActiveRecord::Migration def change remove_column :users, :email add_column :users, :username, :string end end
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.define :chef_server do |v| # Every Vagrant development environment requires a box. You can search for # boxes at https://vagrantcloud.com/search. v.vm.box = "ubuntu/xenial64" v.vm.provider "virtualbox" do |vb| ...
module Fitter module Relations class Steps < ROM::Relation[:sql] schema(:steps, infer: true) do associations do has_many :exercise_records belongs_to :exercise_types, as: :exercise_type end end end end end
require 'test_helper' class HomesControllerTest < ActionController::TestCase setup do @home = homes(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:homes) end end
require 'rails_helper' describe 'User signup page' do it 'creates a new user with valid information' do user_count = User.all.length sign_up('testUser', 'test@test.com', 'password', 'password') expect(current_path).to eq(user_path(User.last)) expect(user_count + 1).to eq(User.all.length) end it ...
# Documentation: https://docs.brew.sh/Formula-Cookbook.html # http://www.rubydoc.info/github/Homebrew/brew/master/Formula # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! class Libctl < Formula desc "Guile-based library implementing flexible control files for scientific simu...
json.array!(@admin_players) do |admin_player| json.extract! admin_player, :id, :email, :first_name, :last_name, :password, :password_confirmation json.url admin_player_url(admin_player, format: :json) end
require 'spec_helper' describe Lolita::DBI::Base do it "should raise error when not ORM class is given" do lambda{ Lolita::DBI::Base.new(String) }.should raise_error Lolita::NotORMClassError lambda{ Lolita::DBI::Base.new() }.should raise_error ArgumentError end it "should detect ada...
# frozen_string_literal: true require 'testing_prerequisites' class TestAsciiPngfy < Minitest::Test def test_that_ascii_pngfy_is_defined ascii_pngfy_defined = defined?(AsciiPngfy) refute_nil(ascii_pngfy_defined) end end
class AddEventTypeToEventNameSticks < ActiveRecord::Migration def self.up add_column :event_name_sticks, :event_type, :string end def self.down remove_column :event_name_sticks, :event_type end end
# frozen_string_literal: true require 'recruiterbox_helper' require 'rails_helper' describe RecruiterboxSync do describe '.call' do before(:all) do Recruiterbox.configure { |config| config.api_key = 'TEST_API_KEY' } end after(:each) do Opening.all.destroy_all Candidate.all.destroy_all...
class AddLeaveYearIdToEmployeeLeaveBalance < ActiveRecord::Migration def self.up add_column :employee_leave_balances, :leave_year_id, :integer end def self.down remove_column :employee_leave_balances, :leave_year_id end end
project = ARGV.shift word = ARGV.shift require "#{project}/config/boot" require "#{project}/config/environment" if word.nil? or word.strip.length == 0 STDOUT << "Place cursor on class name (or variation) to show its schema" exit end klass = word.camelcase.singularize.constantize rescue nil if klass and klass.clas...
class CreateWeighIns < ActiveRecord::Migration[5.2] def change create_table :weigh_ins do |t| t.float :weight t.float :fat t.float :muscle t.integer :visceral_fat t.integer :metabolic_age t.float :water t.timestamps end end end
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable has_many :favorites, dependent: :destroy has_many :producers, through: :favorites has_many :carts, dependent: :destroy has_many :products, through:...
Before do |test| puts "Current scenario: #{test.feature.name}: #{test.name}" end After('@web_ui') do |test| if test.failed? screenshot_path = "test-reports/#{test.name.gsub(' ', '_')}.png" web_app.page.save_screenshot(screenshot_path) puts "Screenshot can be found at #{screenshot_path}" end end Befo...
json.array!(@lecturers) do |lecturer| json.extract! lecturer, :id, :firstname, :lastname, :age, :rating json.url lecturer_url(lecturer, format: :json) end
require_relative '../world' require_relative '../res' require_relative '../engine/entity' class Wall < Entity def initialize(id) img = Gosu::Image.new(File.join(RES_ROOT, "walls", "#{id}.png")) super( position: Point.new(0, World::GLOBAL_FLOOR_Y - img.height * GLOBAL_SCALE, 0), animations: { ...
execute "import pgp key" do command "sudo rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch" end remote_file "/etc/yum.repos.d/elasticsearch.repo" do action :create not_if "test -e /etc/yum.repos.d/elasticsearch.repo" end package "elasticsearch" do action :install end remote_file "/etc/elasticse...
class ImagesController < ApplicationController # POST /images # POST /images.json def create @image = Image.new({image: params[:image]}) respond_to do |format| if @image.save format.html { render json: { name: @image.image.identifier, url: @image.image.url } } format.json { render j...
RSpec.describe Fujitatsu do it "has a version number" do expect(Fujitatsu::VERSION).not_to be nil end end
class RenameAddedByToCreatedByInSongs < ActiveRecord::Migration def self.up rename_column :songs, :added_by, :created_by end def self.down rename_column :songs, :created_by, :added_by end end
require 'dry/transaction/operation' require 'dry-validation' require 'json' Dry::Validation.load_extensions(:monads) class Validate class Schema < Dry::Validation::Contract params do required(:foo).filled required(:bar).filled end end include Dry::Transaction::Operation def call(input) ...
class CreateEntry < ActiveRecord::Migration[5.2] def change create_table :entries do |t| t.text :description t.datetime :date t.timestamps null: false end add_reference :entries, :entity, foreign_key: true end end
class AddTypeIndexToAttachments < ActiveRecord::Migration[5.0] def change add_column :attachments, :attachable_id, :integer, index: true add_column :attachments, :attachable_type, :string, index: true add_index :attachments, [:type] add_index :attachments, [:attachable_id, :attachable_type] add_in...
class CriminalsController < ApplicationController before_action :set_criminal, only: [:show, :edit, :update, :destroy] before_action :check_login def index @criminals = Criminal.alphabetical.paginate(page: params[:page]).per_page(10) @enhanced_powers = Criminal.enhanced.alphabetical.paginate(page: param...
require 'gtk2' class LMGtkIcon < Gtk::StatusIcon attr_writer :unread def initialize super load_images @unread = 0 end def load_images # the images are the same except for their palette. head = "iVBORw0KGgoAAAANSUhEUgAAABAAAAALBAMAAACEzBAKAAAAFVBMVE" # base64 ...
class ProductsController < ApplicationController before_action :set_product, only: [:show, :edit, :update, :destroy] before_action :set_store def index @products = Product.all end def show end def new @product = Product.new end def edit end def create @product = @store.products.new(product_params) ...
module FormErrorsHelper attr_reader :template attr_reader :object def error_span(attribute, options = {}) options[:class] ||= 'help-inline' template.content_tag( :span, self.errors_for(attribute), :class => options[:class] ) if self.errors_on?(attribute) end def errors_on?(attribut...
class RenameTenants < ActiveRecord::Migration def change rename_column :usermanagement_tenants, :user_id, :created_by add_foreign_key :usermanagement_tenants, :usermanagement_users, column: :created_by end end
class CreatePhotos < ActiveRecord::Migration[5.2] def change create_table :photos do |t| t.string :img_url, null: false t.string :title, null: false t.string :description, null: false t.integer :artist_id, null: false t.datetime :created_at, null: false t.string :updated_at, nu...
require 'uri' require_relative 'middleware_base' module BME class Auth < MiddlewareBase def initialize(app) @app = app end def call(env) begin url = env['PATH_INFO'] method = env['REQUEST_METHOD'] if method =~ /(POST|PUT)/ env['authenticated'] = false ...
class TimeCalculator attr_reader :hours, :comment, :errors def self.calculate(options = {}) TimeCalculator.new(options) end def initialize(options) @options = options set_hours end private def test_inputs checked = @options.map do |k, v| v =~ /^\d\d:\d\d$/ end if checke...
class CreateRecipes < ActiveRecord::Migration def change create_table :recipes do |t| t.string :name t.string :instructions t.string :comment t.integer :status t.boolean :gluten_free, default: false t.boolean :fair_trade, default: false # audit markers t.boolean :r...
require 'spec_helper' class FruitService < ServiceCache def self.cache_timeframe 1.day end end class VeggieService < ServiceCache end RSpec.describe ServiceCache do describe "saving" do it "should save a record" do expect{ FruitService.write_cache "apple", {name: 'apple', color:'red', s...
class ChangeColumnName < ActiveRecord::Migration[5.0] def change rename_column :characters, :name_string, :name end end
module BackpackTF # Common methods for objects & response-based classes module Helpers def self.included(base) base.extend(ClassMethods) end # Accessors/shortcuts for reaching the associated Response class from # within a base namespace class. module ClassMethods def response=(new_d...
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # ▼ Self-Switch Reset # Author: Kread-EX # Version 1.0 # Release date: 03/02/2012 #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= #----------------------------------------------------------------------...
# represent a job posted by employer member class Job # include this module to provide calling link_to method inside model include ActionView::Helpers::NumberHelper include Mongoid::Document include Mongoid::Timestamps include Mongoid::Paranoia store_in database: 'sribulancer_development', collection: 'jo...
class Diffutils < Package desc 'GNU Diffutils is a package of several programs related to finding differences between files' homepage 'https://www.gnu.org/software/diffutils/' url 'https://ftp.gnu.org/gnu/diffutils/diffutils-${version}.tar.xz' release version: '3.6', crystax_version: 2 build_copy 'COPYING'...
class CardDeck < ActiveRecord::Base has_and_belongs_to_many :games attr_accessor :cards has_many :cards accepts_nested_attributes_for :cards after_initialize :initialize_cards def initialize_cards @cards ||= [] Card.suits.keys.each do |suit| Card.denominations.keys.each do |denomination| @car...
class ExpiringTags::Tag < ActiveRecord::Base has_many :taggings, class_name: 'ExpiringTags::Tagging', dependent: :destroy validates :tag, presence: true # Equivalent to created_at + expires_in.hours > Time.now scope :active, -> { where("(tags.created_at + (expires_in || 'hours')::interval) >= ? OR expires...
# frozen_string_literal: true FactoryBot.define do factory :example, class: OpenStruct do trait :finished do metadata(execution_result: OpenStruct.new) exception(OpenStruct.new(backtrace: %w[error1 error2])) result(OpenStruct.new( exception: OpenStruct.new( messa...
require_relative 'tile' require 'colorize' class Board attr_reader :grid def self.from_file(filename) file = File.readlines(filename).map(&:chomp) nums = file.join.split('') @grid = Array.new(9) do Array.new(9) { Tile.new(nums.shift.to_i) } end end def initialize(filename) @grid = Bo...
namespace :completion do desc "Generate zsh completion file" task :zsh do Bundler.require(:default) output_path = "etc/t-completion.zsh" file_path = File.expand_path(output_path) puts "Compiling zsh completion to #{output_path}" File.write(file_path, zsh_completion) git_status = `git statu...
class FileHandler attr_accessor :path, :body, :response_code, :content_type, :file_size CONTENT_TYPE_MAPPING = { 'html' => 'text/html', 'txt' => 'text/plain', 'png' => 'image/png', 'jpg' => 'image/jpg', 'haml' => 'text/html' } RESPONSE_CODE = { '100' => 'Continue', '200' => 'OK'...
require 'celluloid/autostart' class StatusObserver include Celluloid include Celluloid::Notifications def initialize(server) @server = server subscribe "status_event", :status_event subscribe "state_change_event", :state_change_event subscribe "completion_percent_event", :completion_percent_even...
class Badge < ActiveRecord::Base has_many :votes belongs_to :teacher end
require File.dirname(__FILE__) + '/../../../spec_helper' describe 'Rackspace::Servers.create_image' do describe 'success' do before(:each) do # flavor 1 = 256, image 3 = gentoo 2008.0 @server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id'] end after(:each) do ...
class FilescanProcessJob < ApplicationJob queue_as :default @@s3_bucket = Aws::S3::Resource.new(client: Rails.application.config.s3_client).bucket(Rails.application.config.scans_bucket) @@s3_service = S3Service.new(@@s3_bucket) @@chunk_size = Rails.application.config.scan_processor_buffer.to_i*1024 def perf...
require File.expand_path('../../../config/environment', __FILE__) require "RMagick" require_relative 'machine_learning/photo' module MachineLearning class DB < Thor desc "insert_dataset", "insert dataset of ML in database" def insert_dataset path = File.expand_path('../../../data/dataset/dataset3k.json...
# frozen_string_literal: true class ContactsController < ApplicationController before_action :set_contact, only: [:show, :update, :destroy] before_action :adjust_contact_params, only: [:mass_create] # GET /contacts def index @contacts = Contact.all render json: @contacts end # GET /contacts/1 ...
class UsersController < ApplicationController before_action :authenticate_user!,except: [:show] def show @user=User.find(params[:id]) @name=@user.name @prototypes=@user.prototypes end end
class Corner < ApplicationRecord belongs_to :team_home_season, optional: true belongs_to :away_team_season, optional: true belongs_to :match end
require "prime" require "colorize" class Untitled2 SLEEP_TIME = 0.1 LOWER_LIMT = 0 UPPER_LIMIT = 1000 LOWER_BASE_LIMIT = 2 UPPER_BASE_LIMIT = 10 PRIME_COLOR = :red NON_PRIME_COLOR = :green def art sleep 1 puts mission!; sleep 15 (LOWER_LIMT..UPPER_LIMIT).each do |x|...
require 'simplecov' SimpleCov.start require 'test/unit/rr' require 'discordrb' require_relative '../bot' class PornhubCommandTest < Test::Unit::TestCase def setup @event = Object.new stub(@event).from_bot? { false } end def test_it_ignores_bot stub(@event).from_bot? { true } result = Commands::...
class CsvReader def initialize(file_path) @file_path = file_path end def read (&callback) headers = nil File.foreach(@file_path).with_index do |line, index| line.encode!('UTF-8', 'ISO-8859-1', :invalid => :replace) line.strip! if index == 1 headers = line.split('|') e...
class Preachment < Section self.authorizer_name = 'PreachmentAuthorizer' include PreachmentRepository mount_uploader :photo, PhotoUploader has_one :info accepts_nested_attributes_for :info has_paper_trail ignore: [:created_at, :updated_at] end
require "rails_helper" describe "Commits page", :js do it "works for simultaneous visitors" do create(:commit, message: "Compute Bernoulli numbers.", url: "/") # URL is "/" so clicking a commit brings us back. visitors :ada, :charles do visit_and_wait_for_message_bus_init "/" expect(page).to ha...
require 'spec_helper' class Musician # pretend that this is an AR model attr_accessor :id, :name, :rating, :errors, :birthplace_id, :alive def initialize(params={}); params.each{|k,v| self.send("#{k}=",v) if self.respond_to?(k)}; end def attributes; {:id => self.id, :name => self.name, :rating => self.rating, :a...
module ActionDispatch::Routing class Mapper def comments_on(*resources) options = resources.extract_options! unless resources.count == 1 raise "too many arguments passed to comments_on. Format is comments_on :articles, :by => :users" end unless options.has_key?(:by) ...
FactoryBot.define do factory :historical_price_result, class: IGMarkets::HistoricalPriceResult do instrument_type :currencies metadata { build :historical_price_result_metadata } prices { [build(:historical_price_result_snapshot)] } end factory :historical_price_result_metadata, class: IGMarkets::His...
class Numeric # Converts this numeric to a Money object in the default currency. It # multiplies the numeric value by 100 and treats that as cents. # # 100.to_money => #<Money @cents=10000> # 100.37.to_money => #<Money @cents=10037> def to_money Money.new(self*100) end end class String def to_m...
class CreateVehicles < ActiveRecord::Migration[6.1] def change create_table :vehicles do |t| t.string :title t.string :stock_type t.string :exterior_color t.string :interior_color t.string :transmission t.string :drivetrain t.integer :price t.integer :miles t...
require 'pp' class Node attr_accessor :neighbours, :visited attr_reader :value def initialize(value) @value = value @neighbours = [] @visited = false end end def create_graph(num_nodes) nodes = [] values = (1..num_nodes).to_a.shuffle num_nodes.times do nodes << Node.new(values.shift) ...
class ImageSerializer < ActiveModel::Serializer attributes :id, :url, : end
module Concerns::Edu::GroupEnrolls extend ActiveSupport::Concern included do has_many :enrollments, class_name: "Acn::Enrollment", dependent: :destroy has_many :users, through: :enrollments belongs_to :cluster, class_name: "Edu::Cluster" counter_culture :cluster, column_name: "ugroups_count" b...
class Style < ActiveRecord::Base has_many :mix_styles has_many :mixes, through: :mix_styles end
require 'active_support/all' require 'nxt_registry' require 'nxt_pipeline/version' require 'nxt_pipeline/logger' require 'nxt_pipeline/pipeline' require 'nxt_pipeline/step' require 'nxt_pipeline/callbacks' require 'nxt_pipeline/error_callback' module NxtPipeline class << self delegate :new, :call, to: Pipeline ...
# 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...
require('rspec') require('pg') require('list') DB = PG.connect({:dbname => 'to_do_test'}) RSpec.configure do |config| config.after(:each) do DB.exec("DELETE FROM lists *;") end end describe('List') do describe("#initialize") do it('should return the name of a newly created list') do new_list = Li...
require File.dirname(__FILE__) + '/base' class Gruff::Bezier < Gruff::Base def draw super return unless @has_data @x_increment = @graph_width / (@column_count - 1).to_f @norm_data.each do |data_row| poly_points = Array.new @d = @d.fill data_row[DATA_COLOR_INDEX] data_row[1].each...
#Part1: Hello World class HelloWorldClass def initialize(name) @name = name.capitalize end def sayHi puts "Hello #(@name)!" end end hello = HelloWorldClass.new("Hannah") hello.sayHi
class SerialReader def initialize(port,sensors) puts "Initializing serial reader on port #{port}" @fd = IO.sysopen(port, "r") @io = IO.new(@fd, "r") @alive = true @thread= Thread.new{self.listen()} @sensors =sensors end def listen puts "Starting listener" while @alive puts "listening" line =...
class CauseCategoriesController < ApplicationController before_action :set_cause_category, only: [:show, :edit, :update, :destroy] # GET /cause_categories # GET /cause_categories.json def index @cause_categories = CauseCategory.all end # GET /cause_categories/1 # GET /cause_categories/1.json def s...
class CreateBuildings < ActiveRecord::Migration[4.2] def change create_table :buildings do |t| t.string :property_name t.text :description t.string :street_address t.string :zip_code t.integer :bin t.string :bbl t.timestamps end add_reference :users, :building, i...
# 1. Write a program which contains a class # • Create a class variable which contains [‘Local’,’Global’,Instance’,’Class’] # • A method that appends the passed element to a class variable (which contains an array) # • A method that prints [‘1’,’2’,3’] and [‘Ruby’,’On’,’Rails’] from passed hash =>{‘1’=>’Ruby’,’2’=>’On...
module Paymark class Error < StandardError attr_reader :thing def initialize(msg="Server Error") super(msg) end end end
module Usermanagement class Family < ActiveRecord::Base has_many :people, inverse_of: :family has_many :accounts, -> { where "usermanagement_people.active IS TRUE" }, through: :people, source: 'own_accounts' # has_many :familyviews, inverse_of: :family # has_many :VIEWABLE_ACCOUNTS, -> { where "user...
require 'hashie' class Member < Hashie::Mash def self.list MEMBER_CONFIG.map(&method(:new)) end def avatar_file_path "members/#{avatar_file}" if avatar_file.present? end def twitter_url "http://twitter.com/#{twitter}" if twitter.present? end def github_url "http://github.com/#{github_n...
class CreateRecordAssignments < ActiveRecord::Migration def self.up create_table :record_assignments do |t| t.integer :course_id t.integer :record_group_id t.integer :priority t.boolean :add_for_future,:default=>false t.timestamps end end def self.down drop_table :record...
# # Script to delete all non-purchased books in collection "Trash" # # Get current user user = (`whoami`).strip # Find iBooks sqlite3 database dir, dbs = "/Users/#{user}/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary", [] Dir.entries( dir).each do |f| dbs << dir + '/' + f if /^BKLibrary-\d*-\d*.sqlite...
require 'spec_helper' describe 'collectd::default' do supported_platforms.each do |platform, versions| versions.each do |version| context "on #{platform.capitalize} #{version}" do cached(:chef_run) do ChefSpec::Runner.new(:platform => platform, :version => version).converge described_reci...
RSpec.describe Zenite::Question do it 'should generate a valid command' do question = Zenite::Question.new question.text = 'This is a question.' expect(question.to_cmd).to eq('zenity --question --text="This is a question."') end it 'should include the general parameters when set' do question = Ze...
class CreateChallengeDeliveriesUsers < ActiveRecord::Migration def change create_table :challenge_deliveries_users, id: false do |t| t.belongs_to :challenge_delivery t.belongs_to :user end add_index :challenge_deliveries_users, [:challenge_delivery_id, :user_id], unique: true, name: 'idx_chall...
module Spina class PhotoCollection < ApplicationRecord include PhotoCollectable has_one :page_part, as: :page_partable has_many :photo_collections_photos, autosave: true has_many :photos, through: :photo_collections_photos has_many :structure_parts, as: :structure_partable accepts_nested_att...
class AddVisibleToConversations < ActiveRecord::Migration def up add_column :conversations, :visible, :boolean, default: true, null: false Conversation.update_all(visible: true) end def down remove_column :conversations, :visible end end
class Ticket < ApplicationRecord mount_base64_uploader :image, ImageUploader validates :title, :user, :ads_id, :text, presence: true belongs_to :user has_many :comments, dependent: :destroy end
require 'rails_helper' RSpec.describe PriceOffer, type: :model do it 'has a valid factory' do expect(create :price_offer).to be_valid end end
class Ride attr_accessor :passenger, :driver, :distance @@all = [] #Initializes a new instance of the Ride class (Ride.new(tony, gracie, 5.2)) and shovels that instance into @@all array def initialize(driver, passenger, distance) @driver = driver @passenger = passenger @distance = distance @@...
class CreatePostCommand include ActiveModel::Model include ActiveEvent::Command form_name 'Post' attributes :title, :text end
class ChatUser < ModelBase include Mongoid::Document include Mongoid::Timestamps belongs_to :chat_room belongs_to :user has_many :chat_msgs, dependent: :destroy field :nickname, type: String def self.Create(userId, chatRoomId, nickname = nil) chatUser = ChatUser.new chatUser.user = User.find(userId) chatU...
require 'fission-package-builder' module Fission module PackageBuilder module Formatters # Format payload using contents provided via code fetcher class CodeFetcher < Fission::Formatter SOURCE = :code_fetcher DESTINATION = :package_builder # Format payload and add informati...
class Task < ActiveRecord::Base has_many :task_macros, :dependent => :delete_all has_many :task_commands, :dependent => :delete_all has_many :macros, through: :task_macros has_many :commands, through: :task_commands serialize :arguments, JSON def run arguments, handler = nil puts "Running Task:: #{se...
# El primer nivel del juego, consiste en saltar y saltar plataformas cojiendo monedas. # Despues de alcanzado el puntaje suficiente aparece un boton para ir al siguiente nivel class Level1 < Chingu::GameState attr_reader :music, :sonido traits :viewport, :timer GAME_OBJECTS = [Base, Moneda, Plataforma, Plat...
class Admin::ExperiencesController < AdminController before_action :set_experience, only: [ :show, :edit, :update, :destroy, :toggle ] # GET /experiences # GET /experiences.json def index @experiences = Experience.all.order(id: :desc) end # GET /experiences/1 # GET /experiences/1.json def sh...
class Card < ActiveRecord::Base belongs_to :user has_one :card_info validates :number, presence: true, format: {with: /\A[0-9]{8}\z/}, uniqueness: true end
class CreateWinningParts < ActiveRecord::Migration def change create_table :winning_parts do |t| t.references :game, index: true, foreign_key: true t.string :text_panel t.float :coordinate_x t.float :coordinate_y t.integer :num_of_element t.timestamps null: false end end...