using associations or better avoiding?

Associations provide a higher level of abstraction for your app. How does adding new methods affect performance?

You can optimize slow queries with multiple joins by using sql instead of ActiveRecord finders. There are also other techniques to speed up the app. As a beginner I would not worry.

As one of my incompetent manager used to say: “Code like a wind”. LOL.

thanks for your quick reply ... so lets say i have a User model which has the following attributes...

firstname lastname creator_id updater_id reports_to

so the user was created by a user .. and the last modification be done by another user .. then each user reports to one user ... moreover the users have friends, send messages, write blog entries, etc.

- would you really add for all this own associations? also e.g. for creator and updater - which are e.g. only used on one place?

probably

- i also load the current logged in user on each request .. would this affect performance if more associations are here?

Having an association or not isn't going to affect the loading a
single record

i am just wondering, because the project is expecting to have 10.000 uniques a day.

Remember what they say about premature optimization :slight_smile: ?

Fred

associations are one of the benefits of using rails. You should be happy to be able to use them!

Adam