DEV Community

Igor Kasyanchuk
Igor Kasyanchuk

Posted on

Rails SQL Views made easy ;)

Hello Rails devs,

I've a new gem:

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

Top comments (1)

eprislac profile image
Eddie Prislac

Does it support Rails 6/7 multiple db configs? I'm looking for something that will allow me to deploy the view to specific databases.