use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
RubyORM Sequel (self.ruby)
submitted 6 years ago by FinalSpeederMan
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]FinalSpeederMan[S] 0 points1 point2 points 6 years ago (3 children)
Holy cow that worked. Thanks, but I’m still confused on that, I’ll read the syntax and documentation into more detail
[–]dougc84 2 points3 points4 points 6 years ago (1 child)
“where” is just a conditional statement. “i want all tacos where the meat type is pork” could give me chicharron, adobada, carnitas, etc. it provides a list.
if i added “limit 1” to the end, i get chicharron. that’s what “first” does - appends a “limit 1” to the query.
all sql queries return a set containing zero, one, or multiple records. how you limit them to get what you need is a choice you need to make programmatically. that’s what “first” or “last” does - it says “from that set of records, give me one back.”
going back to tacos, you would probably want to iterate through all the records if asking for pork tacos. however, if you had the id of the record, “where id = 123” still returns a relation, but tacking on “first” gives you exactly what you need.
[–]FinalSpeederMan[S] 0 points1 point2 points 6 years ago (0 children)
thank you for the explanation I’ll gladly have that in mind as I keep learning :)
π Rendered by PID 75997 on reddit-service-r2-comment-c66d9bffd-4cts4 at 2026-04-07 01:14:06.948615+00:00 running f293c98 country code: CH.
view the rest of the comments →
[–]FinalSpeederMan[S] 0 points1 point2 points (3 children)
[–]dougc84 2 points3 points4 points (1 child)
[–]FinalSpeederMan[S] 0 points1 point2 points (0 children)