Re: Implementing a credit-based system

Frederick Cheung
Fri, 01 Aug 2008 18:53:15 -0000

On 1 Aug 2008, at 19:15, Tim Gossett wrote:

> On Fri, Aug 1, 2008 at 8:45 AM, CPerry
<cory-jEJZ73ctDLTqlBn2x/YWAg@public.gmane.org> wrote:
>
> Hey all, fairly new to Rails here and I am currently building my first
> Rails app.
>
> I am building an app that will require users to purchase credits in
> order to post items on the site. These credits will be purchased in
> blocks of credits like 5, 10, 20, etc. (similar to istockphoto.com).
>
> Here is how I picture setting up the credits in my app.
>
> Credits Model - This model would determine the different credit
> packages (5,10,20) along with the price of each credit package.
>
> Is a Credits model necessary? Would it be easier to have a credits
> attribute (int) on the User model, and increment/decrement
> accordingly?
>
Quite possibly, I think the key point is whether the audit trail is
important: do you need to know where the credits have come from (for a
given user), what they spent them on etc.. ie do you want to be able
to track them?

Fred