Sha256: 28b2b8b50560b272eaa578f6780a63eb90b68c1ee96369da20efd37cd5c9b0de

Contents?: true

Size: 541 Bytes

Versions: 4

Compression:

Stored size: 541 Bytes

Contents

if defined? DataMapper::Resource

class Author
  include DataMapper::Resource
  property :id, Serial
  property :first_name, String
  property :last_name, String
  property :created_at, DateTime
  property :updated_at, DateTime
  has n, :books
end


elsif defined? Sequel::Model

class Author < Sequel::Model
  one_to_many :books
end

else

class Author < ActiveRecord::Base
  has_many :books
end

end

# ORM-agnostic bits
class Author

  # virtual attribute
  def name
    "#{last_name}, #{first_name}"
  end

  netzke_attribute :name

end

Version data entries

4 entries across 4 versions & 2 rubygems

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