Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # SystemStackError: stack level too deep
- # from /Users/johnslivka/.rvm/rubies/ruby-1.9.2-#p290/lib/ruby/1.9.1/irb/workspace.rb:80
- #Maybe IRB bug!!
- class User
- include DataMapper::Resource
- property :id, Serial
- property :email, String, :length => 255#, :required => true
- has n, :relationships
- has n, :followers, :through => :relationships, :model => 'User',
- :child_key => [:user_id]
- has n, :follows, :through => :relationships, :model => 'User',
- :via => :user, :child_key => [:follower_id]
- end
- class Relationship
- include DataMapper::Resource
- property :user_id, Integer, :key => true
- property :follower_id, Integer, :key => true
- belongs_to :user, :child_key => [:user_id]
- belongs_to :follower, :model => 'User', :child_key => [:follower_id]
- end
Add Comment
Please, Sign In to add comment