Andy DeVane


2,230 Experience
22 Lessons Completed
0 Questions Solved


Posted in why .limit not working with find_by

Thanks Chris! Thanks for all you do.

Posted in Is there a better way to simplify this?


Posted in why .limit not working with find_by

find_by only returns the first object that matches your query. You're calling limit on an instance of your category model which causes this error. Try using Category.where instead, .where returns an array instead of an object.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.