Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Homenagem ao professor @rodrigomanhaes
# -*- encoding : utf-8 -*-
#
# Rodrigo Soares Manhães, professor homenageado pelos formandos da turma de 2007
# do curso de Ciência da Computação da UENF.
#
# 20/09/2012
#
##
class Aluno < ActiveRecord::Base
belongs_to :turma
attr_accessible :nome
end
class Turma < ActiveRecord::Base
has_many :alunos
attr_accessible :ano
def agradecer
[
'Rodrigo,',
'',
'Você foi o cara que mais influenciou em nossa formação profissional e ',
'merece nosso respeito tecnológico.',
'',
'Obrigado por tudo,',
*alunos.map(&:nome),
'',
'20/09/2012'
].join("\n")
end
end
turma = FactoryGirl.create :turma, ano: 2007
['Hugo', 'Pedro', 'Elisson'].each do |n|
FactoryGirl.crate :aluno, nome: n, turma: turma
end
turma.reload.agradecer
@bernardobarreto

This comment has been minimized.

Copy link

@bernardobarreto bernardobarreto commented Sep 21, 2012

FactoryGirl.crate :aluno, nome: n, turma: turma # crate? =P

@elissonmichael

This comment has been minimized.

Copy link

@elissonmichael elissonmichael commented Jun 19, 2018

Esse cara merece!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.