Jonathan Greenberg

Joined

1,410 Experience
14 Lessons Completed
0 Questions Solved

Activity

I recently created a DomainConstraint in an app and used a database query which checks to see if there is a match with any of the saved domains. I do see now that it does add the query to every request but the cost is just a couple of milliseconds. I suppose that I could figure out a way to avoid the database query by caching the saved domain values or instead setting a general constant for the main (i.e. non-custom) domains and doing a non-match against that. I wonder though if it is worth the effort at this point not to mention the added complexity. Are there other hidden costs beyond the few milliseconds I should be considering?

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.