Kasper Timm Hansen


210 Experience
2 Lessons Completed
0 Questions Solved


Posted in Datatables From Scratch Using Hotwire Discussion

presence_in can be nice to quiet down those ternaries and avoid the double params[:sort] which makes the line busy:

params[:sort].presence_in(%w{ name position office age start_date }) || "name"

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

© 2023 GoRails, LLC. All rights reserved.