Guest User

Untitled

a guest
Apr 27th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. # With a subselect
  2. @authors = Author.find(:all, :conditions => %{id in (
  3. select e.author_id from extensions e where e.size != 0
  4. )})
  5.  
  6. # With the :joins key
  7. @authors = Author.find(:all, {
  8. :joins => 'extensions on extensions.author_id = authors.id',
  9. :conditions => 'extensions.size != 0',
  10. :readonly => false # Not sure why :joins key implies ":readonly => true"
  11. })
Add Comment
Please, Sign In to add comment