私はこのようなものを作りたいです:
class Result<<ActiveRecord::Base
def condensation
#some code here that calculates @winner and @looser and @condresalut
def winner
@winner
end
def looser
@looser
end
def showresault
@condresalut
end
end
end
res.condensation.winner
andres.condensation.looser
とを呼び出せるようにしres.condensation.showresault
ます。
それを行う最良の方法は何ですか?どうやらこの方法ではうまくいかないので、nilを取得しました。