Frank Jensen Wed Aug 04 08:49:10 -0400 2010

Subject: Custom variables


Firstly, thanks for an awesome implementation of ActiveRecord.

Im using it for the first time and sofar everything is great.

Let me explain my situation. I have a database containing votes. What i need to do is calculate a base_score for each vote object based on the number of votes on a specific subject vs. total votes, so i can do:

$vote = Vote::find(1)
echo $vote->base_score

Anyone have a suggestion on how to do this?


Kien La Thu Aug 05 21:11:20 -0400 2010

Are you asking if there is a way to have the $vote->base_score call execute some code? Like a getter?