Sha256: 41240488e68824ccf80e319276d1c0e654758dd5c58e240f249344791712008e

Contents?: true

Size: 753 Bytes

Versions: 4

Compression:

Stored size: 753 Bytes

Contents

module Seedy
  class Teams < Record
    self.columns = {
      :id   => :guid,
      :name => :association,
      :date_entered => :date_time,
      :date_modified => :date_time,
      :associated_user_id => :association,
      :modified_user_id => 1,
      :private => 1,
      :description => :association
    }
    
    class << self
      def build(user)
        team = Teams.new
        team.associate(user)
        team
      end
    end
    
    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
    
    def team_description
      "Private team for #{read_attribute(:name)}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
seedy-0.6.6 lib/seedy/records/teams.rb
seedy-0.6.5 lib/seedy/records/teams.rb
seedy-0.6.4 lib/seedy/records/teams.rb
seedy-0.6.3 lib/seedy/records/teams.rb