Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby ActiveRecord Basics Query Interface Finding Scopes

Chris Underwood
Chris Underwood
Full Stack JavaScript Techdegree Student 19,916 Points

Finding Scopes Code Challenge 2

I am on the struggle bus with this code challenge. Below is my code which, based on the examples I have seen in the videos and the Rails documentation I believe is right but I cannot get it to pass.


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

I am not looking for someone to give me the answer, but a nudge in the right direction would be appreciated.



2 Answers

Carlos Reyes
Carlos Reyes
30,056 Points

I tried: LIKE, IS, =

Then I went trough the video transcripts, Ctrl+F, "name"... trying to find an example!