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 trial

Ruby ActiveRecord Basics Query Interface Finding Scopes 2

Natansh Pandya
Natansh Pandya
2,810 Points

Scope is not giving correct answer?

class Person < ActiveRecord::Base scope :hamptons -> {where("first_name LIKE ?" , "Hampton")} end

1 Answer

Kang-Kyu Lee
Kang-Kyu Lee
52,045 Points

I tried right now, and the answer was

scope :hamptons, -> { where(first_name: "Hampton") } 

as shown in the beginning of Finding Control. I guess this is what the question wanted. I don't get why your answer couldn't pass...

Did anyone ever get this sorted out? Because I'd like to know the answer, too, and I don't have time to waste trying to figuring out the answer to a question, only to find out that the correct answer is rejected.