Putting restrictions on votes and comments

Hello,
I am new ro rails and developing an ROR application and want to have
configurations for votes and comments that can be posted by a user.

For example-
For an item the restriction is 1 vote and 2 comments. For all items 10
votes and 10 comments in one day…

But these numbers could be changed and need to be configurable.

Does anybody have any neat ideas on how to implement this with ROR. I
can defnitely implement it, but would like to ensure that I am not
overlooking any neat tricks here…

thanks,
Sandeep.

Sandeep, all the restrictions you have are the business rules for your
system. These will be implemented in your models. You can configure
the actual values used by your business rules by storing them in the
database. Write small methods that will implement various rules in the
appropriate models. Then you can reuse them in the controllers and if
required in the views.

I found some good examples similar to your problem in Patrick Lenz’s
Rails book. You can download the code from the sitepoint site. Use
submissions as the password for download.

Thanks Bala. Actually I do have the book and code you are referring
to. Not sure if I follow you on your pointer of business rules in this
book though… Couldn’t find much there…