Home ActiveRecord caching in controller and model
Reply: 0

ActiveRecord caching in controller and model

user406
1#
user406 Published in July 20, 2018, 1:14 am

If I do a query in Model, would the result be cached like it does in the controller?

model User < ActiveRecord::Base
  has_many :emails, through: :memberships

  def emails?
    emails.exists?
  end
end

If it doesn't cache the result, would changing from exists? to present? or any? make any better?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297163 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO