For example, I have it in the index controller
@users = User.current
this is my user model
scope :current, :conditions => { :active => true }, :order => 'LOWER(first_name), LOWER(last_name) ASC'
Which basically captures all the records, and I don't paginate, because I use a djatables jquery table that has an excellent filter search ... the problem I want to achieve is to cache them if possible, if there are no new users ... which does not happen very often
I read about fresh_when but didn't know what could be used here
UPDATE
After the answer below, I do not see CACHE in the log that I see
Company Load (0.4ms) SELECT `companies`.* FROM `companies` INNER JOIN `positions` ON `companies`.`id` = `positions`.`company_id` WHERE `positions`.`user_id` = 551
Company Load (0.4ms) SELECT `companies`.* FROM `companies` INNER JOIN `positions` ON `companies`.`id` = `positions`.`company_id` WHERE `positions`.`user_id` = 93
Company Load (0.4ms) SELECT `companies`.* FROM `companies` INNER JOIN `positions` ON `companies`.`id` = `positions`.`company_id` WHERE `positions`.`user_id` = 668
Trace source
share