Sha256: f5e415390e96c4a324bd981e049b5777a79214ccf3da9affacf764c79502caef

Contents?: true

Size: 1.44 KB

Versions: 12

Compression:

Stored size: 1.44 KB

Contents

require 'sqlite3'
require 'active_record'
require 'protected_attributes'

ActiveRecord::Base.establish_connection(
  :adapter => 'sqlite3',
  :database => 'test.db'
)

ActiveRecord::Schema.define(:version => 1) do
  create_table "artists", :force => true do |t|
    t.string   "name"
    t.string   "website"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "albums", :force => true do |t|
    t.string   "title"
    t.integer  "year"
    t.integer  "artist_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "songs", :force => true do |t|
    t.string   "title"
    t.integer  "album_id"
    t.integer  "artist_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "payments", :force => true do |t|
    t.integer "amount"
    t.integer  "artist_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end
end

module MyApp
  class Artist < ActiveRecord::Base
    attr_accessible :name, :website

    has_many :albums
    has_many :songs
    has_many :payments
  end

  class Album < ActiveRecord::Base
    attr_accessible :title, :year, :artist
    scope :classic, -> { where("year < 1950") }

    belongs_to :artist
    has_many :songs
  end

  class Song < ActiveRecord::Base
    attr_accessible :title, :artist, :album

    belongs_to :artist
    belongs_to :album
  end

  class Payment < ActiveRecord::Base
    attr_accessible :amount, :artist

    belongs_to :artist
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
restpack_serializer-0.4.25 spec/fixtures/db.rb
restpack_serializer-0.4.24 spec/fixtures/db.rb
restpack_serializer-0.4.23 spec/fixtures/db.rb
restpack_serializer-0.4.21 spec/fixtures/db.rb
restpack_serializer-0.4.20 spec/fixtures/db.rb
restpack_serializer-0.4.19 spec/fixtures/db.rb
restpack_serializer-0.4.18 spec/fixtures/db.rb
restpack_serializer-0.4.17 spec/fixtures/db.rb
restpack_serializer-0.4.16 spec/fixtures/db.rb
restpack_serializer-0.4.15 spec/fixtures/db.rb
restpack_serializer-0.4.14 spec/fixtures/db.rb
restpack_serializer-0.4.13 spec/fixtures/db.rb