I have a User model with a scope :superhero and I want to do an AR query along the lines of:
@avengers_powers = Power.where(etc.).includes(User.where( #{this is where I want to limit by superhero scope} ))
My users schema is:
create_table "users", :force => true do |t| t.string "uid" t.string "name" t.datetime "created_at" t.datetime "updated_at" t.string "token" t.text "ability" t.string "location" end
My user model has:
scope :superhero, where("ability like '%laser vision%' OR ability like '%invisibility%'") scope :hobo, where("location like '%cardboard box%'")
Seeing as :superhero and :hobo aren't attributes on the user model, how would I query it?