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,
: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