Challenge 2: Raw SQL to Active Record — Solution Raw SQL: SELECT * FROM posts WHERE published = 1 ORDER BY title ASC LIMIT 10 Active Record equivalent: Post.where(published: true).order(title: :asc).limit(10) =begin Notes: - WHERE published = 1 becomes .where(published: true) -- Active Record handles the boolean-to-integer translation automatically since the published column was defined as a boolean type in the migration. - ORDER BY title ASC becomes .order(title: :asc) -- the direction is passed as a symbol (:asc or :desc) rather than written as a bare SQL keyword. - LIMIT 10 becomes .limit(10) directly, with no syntax change needed at all beyond the method-call style. - Each of the three chained methods (.where, .order, .limit) returns another chainable query object rather than immediately running anything -- the entire chain compiles down to one single SQL query, functionally identical to the raw SQL version, only executed once the result is actually used (printed, looped over, etc.). =end