Sha256: 0798afeb728462ae33154d316f17b9d046bb132a5c3e7ce0214fb80dbdd1c6a9

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 KB

Contents

require 'rails'
require 'rails/all'
require 'active_support/core_ext'

require 'pry-rails'

begin
  require 'mongoid'
rescue LoadError # Mongoid doesn't support Rails 3.0
end

# Initialize our test app

class TestApp < Rails::Application
  config.active_support.deprecation = :log
  config.eager_load = false

  config.secret_token = 'a' * 100

  config.root = File.expand_path('../..', __FILE__)
end

TestApp.initialize!

# Create in-memory database

ActiveRecord::Migration.verbose = false

ActiveRecord::Schema.define do
  create_table :pokemons do |t|
    t.string :name
    t.binary :caught
    t.string :species
    t.string :abilities
  end

  create_table :hackers do |t|
    t.integer :social_ability
  end

  create_table :beers do |t|
    t.string :name
    t.string :type
    t.integer :rating
    t.integer :ibu
    t.integer :abv
  end
end

# Define models

class Beer < ActiveRecord::Base
  belongs_to :hacker
end

class Hacker < ActiveRecord::Base
  has_many :pokemons
  has_many :beers
end

class Pokemon < ActiveRecord::Base
  belongs_to :hacker
  has_many :beers, :through => :hacker
end

if defined?(Mongoid)
  class Artist
    include Mongoid::Document

    field :name, :type => String
    embeds_one :beer
    embeds_many :instruments
  end

  class Instrument
    include Mongoid::Document

    field :name, :type => String
    embedded_in :artist
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
pry-rails-0.3.11 spec/config/environment.rb
pry-rails-0.3.10 spec/config/environment.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-rails-0.3.9/spec/config/environment.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-rails-0.3.9/spec/config/environment.rb
pry-rails-0.3.9 spec/config/environment.rb
pry-rails-0.3.8 spec/config/environment.rb
pry-rails-0.3.7 spec/config/environment.rb