SHARE
TWEET

Untitled

a guest Dec 31st, 2012 15 Never
  1. class User < ActiveRecord::Base
  2.   devise :database_authenticatable, :registerable,
  3.          :recoverable, :rememberable, :trackable, :validatable
  4.  
  5.   attr_accessible :email, :password, :password_confirmation, :remember_me, :name
  6.   default_scope :order => 'name ASC'
  7.  
  8.   has_many :tournaments
  9.   has_many :memberships
  10.   has_many :clubs, :through => :memberships
  11.  
  12.   def organises(tournament)
  13.     tournament.user.clubs.each do |club|
  14.       return true if club.owner == self
  15.     end
  16.     false
  17.   end
  18. end
RAW Paste Data
Top