Rails SQL Views made easy ;)
Igor Kasyanchuk
Posted on February 15, 2022
Hello Rails devs,
I've a new gem:
https://github.com/igorkasyanchuk/sql_view
To skip long sentences just check the demo below:
How to use:
rails g sql_view:view ActiveUsers 'User.confirmed.where(active: true)' --materialized
rails g sql_view:view DeletedProject 'Project.only_deleted'
Create a SQL view from AR relation (or plain SQL).
This is an easier alternative to scenic gem which is wonderful, but as for me requires more steps to add support of rails view into your project.
PS: production-ready, at least on my projects it works, so far so good ;)
💖 💪 🙅 🚩
Igor Kasyanchuk
Posted on February 15, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.