Db connection within several applications (mountable engine)

Hi @ all,

we are developing an application consisting of several components. these
components will be connected inside a mountable engine. our component
has to interact with another component and we would like to connect two
of the database tables with a has_many and belongs_to relation.

more details:

lets assume we have only two apps inside this mountable engine:
festivalmanagement and usermanagement

inside the festivalmanagement exist a model ticket and we have the
relation, that each user can have many tickets and each ticket belongs
to one user. the ticket is a model of the festivalmanagement

what we would like to do is getting informations about the user by doing
something like

id = @ticket.user.id
name = ticket.user.name
and so on…

so we want to have a direkt possibility to ask for the attributes of a
user, which is not part of our app.

of course we can do a select statement by using the user id of a ticket
(the user id is part of the database table tickets),
but we thought that there should exist a more beautiful possibility.

is it enough just to add
has_many tickets
to the user model and
belongs_to user
to the ticket model?

hope someone can help me.

kind regards

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs