While you can already do something like this with
execute in your migrations:
execute("CREATE VIEW my_tasty_snacks AS SELECT * FROM snacks WHERE food = 'Tasty';")
With RailsOnPage, you’re provided a DSL so that you can do the following:
create_view :my_tasy_snacks do |view| view.select '*' view.from 'snacks' view.conditions 'food' => 'Tasty' end
note: I haven’t tested the above, just a hypothetical example
Anyhow, if you’re in the habit of using views, functions, or triggers with your PostgreSQL database and are using Ruby on Rails, you might give RailsOnPg a whirl.