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 bernhard
on 2012-06-06 09:11
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.