RailsOnPg released

Hello fellow PostgreSQL and Ruby on Rails geeks,

Alexander Tretyakov (twitter) recently released a plugin for Ruby on Rails, which extends migrations and provides you with the ability to create.

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’;”){lang=”ruby”}\

With RailsOnPage, you’re provided a DSL so that you can do the following:


create_view :my_tasy_snacks do |view|{lang=”ruby”}
view.select ‘*’{lang=”ruby”}
view.from ‘snacks’{lang=”ruby”}
view.conditions ‘food’ => ‘Tasty’{lang=”ruby”}
end{lang=”ruby”}\

[note: I haven’t tested the above, just a hypothetical example]{.small}

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.

Hi, I'm Robby.

Robby Russell

I run Planet Argon, where we help organizations keep their Ruby on Rails apps maintainable—so they don't have to start over. I created Oh My Zsh to make developers more efficient and host the Maintainable.fm podcast to explore what it takes to build software that lasts.