Scoping two models on approved
- by Shaun Frost Duke Jackson
I have three models (Book,Snippet,User) and I'd like to create a scope for where(:approved = true)
I'm doing this so I can use the merit gem to define ranking based on count of approved.
I'm thinking that writing this as a scope might be to complex but I don't know as I've just started leaning scopes.
I've currently got this in my Book & Snippet Model:
scope :approved, -> { where(approved: true) }
I've playing around with this in my user model but I don't think it's correct:
scope :approved, joins(:books && :snippets)
Could anyone help start me off or give me some suggestions on what to read?