Class: Seedy::Teams

Inherits:
Record show all
Defined in:
lib/seedy/records/teams.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Record

#initialize, #inspect, #to_s, #to_sql

Constructor Details

This class inherits a constructor from Seedy::Record

Class Method Details

.build(user) ⇒ Object



15
16
17
18
19
# File 'lib/seedy/records/teams.rb', line 15

def build(user)
  team = Teams.new
  team.associate(user)
  team
end

Instance Method Details

#associate(user) ⇒ Object



22
23
24
25
26
# File 'lib/seedy/records/teams.rb', line 22

def associate(user)
  write_attribute(:name, user.first_name + " " + user.last_name)
  write_attribute(:associated_user_id, user.id)
  write_attribute(:description, team_description)
end

#team_descriptionObject



28
29
30
# File 'lib/seedy/records/teams.rb', line 28

def team_description
  "Private team for #{read_attribute(:name)}"
end