Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panda, Tiger & Eagle levels complete #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Panda, Tiger & Eagle levels complete #14

wants to merge 3 commits into from

Conversation

ralphos
Copy link

@ralphos ralphos commented Dec 10, 2012

I cheated a little since I had already done this exercise in the previous batch (though I did change it up so my answer is not exactly the same). Nonetheless, it was a good recap on the basics of ActiveRecord and I do enjoy this approach of incrementally learning about the inner-workings of Rails!

puts "Sorry, I can't do that right now."
puts "~>"
input = gets.chomp.capitalize
sport = Sport.where(name: input)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably name this sports, not sport since it references an array

If you do want to just find one of them, you can either:

Sport.find_by_name(input)
Sport.where(name: input).first

@jwo
Copy link
Member

jwo commented Dec 12, 2012

Looks great -- added a minor note about plural and how to fetch just 1 record.

@ralphos
Copy link
Author

ralphos commented Dec 13, 2012

Thanks! Fixed the naming of my variable too 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants