Sha256: fcb47031d2dc775232131cdaf9779ecb3af9dfb3f0d2bb9f5c1506adfdb61688

Contents?: true

Size: 831 Bytes

Versions: 5

Compression:

Stored size: 831 Bytes

Contents

require 'rubygems'
require 'test/spec'
require 'mocha'
require 'redgreen'
require 'active_support'
require 'active_record'

$:.unshift File.dirname(__FILE__) + '/../lib'
require 'ambition'

class User
  extend Ambition

  def self.reflections
    return @reflections if @reflections
    @reflections = {}
    @reflections[:ideas]    = Reflection.new(:has_many,   'user_id',     :ideas,   'ideas')
    @reflections[:invites]  = Reflection.new(:has_many,   'referrer_id', :invites, 'invites')
    @reflections[:profile]  = Reflection.new(:has_one,    'user_id',     :profile, 'profiles')
    @reflections[:account]  = Reflection.new(:belongs_to, 'account_id',  :account, 'accounts')
    @reflections
  end

  def self.table_name
    'users'
  end
end

class Reflection < Struct.new(:macro, :primary_key_name, :name, :table_name)
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
cheat-1.3.3 lib/ambition/test/helper.rb
cheat-1.3.2 lib/ambition/test/helper.rb
cheat-1.3.1 lib/ambition/test/helper.rb
cheat-1.3.0 lib/ambition/test/helper.rb
ambition-0.1.0 ./test/helper.rb