Rails SQL Views made easy ;)

igorkasyanchuk

Igor Kasyanchuk

Posted on February 15, 2022

Rails SQL Views made easy ;)

Hello Rails devs,

I've a new gem:

https://github.com/igorkasyanchuk/sql_view

To skip long sentences just check the demo below:

Demo

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).
Enter fullscreen mode Exit fullscreen mode

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 ;)

💖 💪 🙅 🚩
igorkasyanchuk
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.

Related

Rails SQL Views made easy ;)
rails Rails SQL Views made easy ;)

February 15, 2022