# STI -Defining Required Parameters

**URL:** <https://www.ruby-forum.com/t/sti-defining-required-parameters/109998>\
**Category:** Rails\
**Created:** [July 21, 2007, 1:17am UTC](https://www.ruby-forum.com/t/sti-defining-required-parameters/109998 "2007-07-21T01:17:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjmadsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b3f665/32.png) [@sjmadsen](https://www.ruby-forum.com/u/sjmadsen)\
**Post date:** [July 21, 2007, 1:17am UTC](https://www.ruby-forum.com/t/sti-defining-required-parameters/109998/1 "2007-07-21T01:17:01Z")

</div>

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  
type.

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  
type.

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  
it.

Thanks
