Database Views with Scenic

Database views are a great way to separate the complexities of database persistence from your application logic. Unfortunately Rails doesn't have built-in support for them, making them difficult to work with. Scenic, a new gem from thoughtbot, makes generating and maintaining your database views as easy as any other database migration. Join Derek and Chris as they dive into database views with Scenic.


This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/database-views-with-scenic

Can I just say that I love this gem? It allows you to treat db views an an ActiveRecord model, which means you can add scopes, associations, etc to make your life easier. Migrations are easy to write and update. It’s great alternative to writing and maintaining code that utilizes the ActiveRecord::Calculations api.