Sha256: 08df557f16ce94c61c4b1a67e22d729daf5d62550f72202cde19bee1191d61d2

Contents?: true

Size: 477 Bytes

Versions: 4

Compression:

Stored size: 477 Bytes

Contents

if defined? DataMapper::Resource

class BookWithCustomPrimaryKey
  include DataMapper::Resource
  property :uid, Serial
  belongs_to :author
  property :title, String
  property :created_at, DateTime
  property :updated_at, DateTime
end

elsif defined? Sequel::Model

class BookWithCustomPrimaryKey < Sequel::Model
  set_primary_key :uid
  many_to_one :author
end

else

class BookWithCustomPrimaryKey < ActiveRecord::Base
  set_primary_key 'uid'
  belongs_to :author
end

end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
netzke-basepack-0.7.7 test/basepack_test_app/app/models/book_with_custom_primary_key.rb
netzke-basepack-zh-0.7.6 test/basepack_test_app/app/models/book_with_custom_primary_key.rb
netzke-basepack-0.7.6 test/basepack_test_app/app/models/book_with_custom_primary_key.rb
netzke-basepack-0.7.5 test/basepack_test_app/app/models/book_with_custom_primary_key.rb