Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAce Motanya
31,756 PointsBuild a finder scope called hamptons to find all people with the first_name "Hampton"
I do not think I am querying against the current Person or something but I have tried everything and nothing will work. I have tried using self.first_name and @first_name.
4 Answers
Ace Motanya
31,756 Pointsclass Person < ActiveRecord::Base
scope :hamptons, -> { where(first_name: "Hampton")}
end
Ace Motanya
31,756 PointsOh, nevermind. I got it working, with first_name: "Hampton"
I had an extra comma between it.
Brad Lait
8,343 PointsSorry I am having the same problem what is the full answer?
priscillapwood
5,521 PointsHere's the answer:
scope :hamptons, -> { where(first_name: "Hampton")}
Jose Ramos
785 PointsHow is "scope :hamptons, -> { where("first_name = ?", "Hampton") }" not an acceptable answer... ?