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

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!