addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

TIL about template option with pg gem in database.yml

From: Andrew M.
Sent on: Tuesday, October 23, 2012 3:57 PM
Greetings,

At the last rails meetup I brought up a question about making rails + postgresql + postGIS + rspec work.
It turns out that if you are using the pg gem, it supports template: option in database.yml. 
I wish this was better documented.
It's completely obvious now that I figured it out, but I figured it doesn't hurt to post the answer.

If you ever run into a situation where postgres is missing datatypes like geometry in my case, this is very likely the answer.
I kind of wish that the pg gem would auto generate the template option in database.yml on a new rails project so that would explicitly know which template (if more than one exist for a user) you are using. 

The specific error message I was getting was: PG::Error: ERROR:  relation "geometry_columns" does not exist.
None of the current stackover flow answers that key on that error mention setting the template flag.

Respectfully,
Andrew McElroy

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy