Closed halfghaninne closed 8 years ago
Using either a Rails association (e.g. has_many
) or a joins
(or include
) of some kind would be ideal here. The custom method you cited would be a very expensive one, as each entry would have to run entry.job_application
which pings the database.
(Because, duh.)
Currently, both
JobApplication
andOffer
models have a class method.retrieve_all_for_user(user)
. This should be instead moved into theUser
model.Either with something simple on the class like:
has_many :job_applications, through: entries
(not sure if that association works that a User has many Entries, but an Entry only has one Job App)Or writing a custom method like:
The above would be repeated for
offers
(and later forpositions
, when they exist).