I'm currently writing some intranet web application where people could submit to admins requests for adding different resources. The example requests would be:
- installing programs, in this case user will select which program he wants installed
- increasing quota, in this case user will just enter the amount of disk space he needs or maybe he will select the predefined quantities - 1GB, 10GB etc...
- create new email alias, in this case user will just type the alias.
- ...
I was thinking about having just one model UserRequests with the reference to the sender and two optional attributes one would be reference_id that would refefrence to other tables (for example the Program that he wants installed) and another would be used for free type fields like email alias or quota.
So my problem is that based on the type of the request the model should contain either:
- reference to other table
- integer data
- string data
Based on the type of the request the given action should be taken - probably email alias could be added from rails but the application on users computer will be installed by hand.
Does anyone had similar problem? Do you think using polymorphism for this kind of stuff is a good idea? Do you have any suggestions on how to organize data in the tables?