Forum: Ruby on Rails putting restrictions on votes and comments

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
4ef13c377f2d1c9e907a73b92335a868?d=identicon&s=25 newtorails. (Guest)
on 2007-02-27 00:00
(Received via mailing list)
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..

E3640176765dae2465d33ef6eb114691?d=identicon&s=25 Bala Paranj (Guest)
on 2007-02-27 00:19
(Received via mailing list)
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.
4ef13c377f2d1c9e907a73b92335a868?d=identicon&s=25 newtorails. (Guest)
on 2007-02-27 02:04
(Received via mailing list)
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..
This topic is locked and can not be replied to.