# Question about relations

**URL:** <https://discuss.rubyonrails.org/t/question-about-relations/13027>\
**Category:** rubyonrails-talk\
**Created:** [May 16, 2007, 4:14pm UTC](https://discuss.rubyonrails.org/t/question-about-relations/13027 "2007-05-16T16:14:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laurent1](https://avatars.discourse-cdn.com/v4/letter/l/858c86/32.png) [@Laurent1](https://discuss.rubyonrails.org/u/Laurent1)\
**Post date:** [May 16, 2007, 4:14pm UTC](https://discuss.rubyonrails.org/t/question-about-relations/13027/1 "2007-05-16T16:14:49Z")

</div>

Hi

We get a little problem to do some relations between to Models :

First we have to Tables :

Roles : id (pk) .. c\_type\_role

Role\_Action\_Relations : id (pk) ... c\_type\_role\_id

For one class of role (Roles.c\_type\_role) we can have many associated permitted actions (Role\_Action\_Relations)

We would like to have a relation OneToMany between Roles and Role\_Action\_Relations : the foreign key Roles.C\_TYPE\_ROLE would be linked to Role\_Action\_Relations.c\_type\_role\_id

As our columns don't follow the convention for RoR, we've designed the Models like this :

class Role \< ... has\_many :role\_action\_relation, &nbsp;&nbsp;:finder\_sql =\> ' here the sql statement to get children rows from Role\_Action\_Relations' end

class Role\_Action\_Relation \< ...

end

My question is : Is there a simpler method to do this relation, because we encounter some problems with the finder\_sql option.

Thanks

Laurent
