thanks a lot everybody! On Feb 16, 12:36 pm, kevinpfromnm <[email protected]> wrote: > On Wednesday, February 16, 2011 1:31:11 PM UTC-7, Matt jones wrote: > > > def create_permitted? > > return false unless user.signed_up? > > return false if post.comments.exists?(:user_id => acting_user.id) > > user_is? acting_user > > end > > > This will completely avoid even loading the other comments (it does a > > single select with the conditions supplied + the association conditions). > > > --Matt Jones > > I figured that given the use, it'll probably be on a post show page that > already includes the full comments+user association in it's load (or it > should unless you're paginating comments). But, yeah, otherwise a single > sql call would be preferable.
-- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
