Forum: Ruby on Rails STI -Defining Required Parameters

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.
Eb6032a3c0ea5b5484d398db2782f779?d=identicon&s=25 Steve Martocci (smartocci)
on 2007-07-21 01:17
Hi everyone,

I have been struggling with this issue for some time, and I really need
some help.

I have a user system with several "accounts" each account has different
set of  validation rules for a different number of attributes.  I have
used STI for the accounts and setup different validation rules for each

My problem is I need to get a list of the required attributes to create
each type.  The only solution I see right now is to create a function
that would return a list of the required params, but I would like to
solve this with a data driven solution if I could. I can't iterate
through the table elements because it includes the attributes for each

Any ideas of how to do this?  I used to have a complex solution using an
account spec, with a has_many set of params.  But I want to do away with

This topic is locked and can not be replied to.