Module: Rubix::Associations::BelongsToUser

Included in:
Medium, Operation
Defined in:
lib/rubix/associations/belongs_to_user.rb

Instance Method Summary collapse

Instance Method Details

#userObject


12
13
14
15
16
# File 'lib/rubix/associations/belongs_to_user.rb', line 12

def user
  return @user if @user
  return unless @user_id
  @user = User.find(:id => @user_id)
end

#user=(u) ⇒ Object


6
7
8
9
10
# File 'lib/rubix/associations/belongs_to_user.rb', line 6

def user= u
  return unless u
  @user    = u
  @user_id = u.id
end

#user_idObject


23
24
25
26
27
# File 'lib/rubix/associations/belongs_to_user.rb', line 23

def user_id
  return @user_id if @user_id
  return unless @user
  @user_id = @user.id
end

#user_id=(uid) ⇒ Object


18
19
20
21
# File 'lib/rubix/associations/belongs_to_user.rb', line 18

def user_id= uid
  return unless uid
  @user_id = uid
end