Forum: Ruby on Rails Question about relations

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.
Laurent (Guest)
on 2007-05-16 20:15
(Received via mailing list)

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

First we have to Tables :

Roles :
id (pk)

Role_Action_Relations :
id (pk)

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

class Role_Action_Relation < ...


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


This topic is locked and can not be replied to.