Technology Insights

What Exactly Does the Scaffold_Resource Generator give you?

The regular scaffold generator (e.g. ruby script/generate scaffold model controller) requires you to create your model and controller first. The scaffold_resource generator, on the other hand, generates the (RESTful) model and controller for you. For example: ruby script/generate scaffold_resource Caregiver first_name:string last_name:string In Rails 2.0, use resource instead: ruby script/generate resource Caregiver first_name:string last_name:string Here’s…

Technology Errors

“Multiple Default Values” Migration Error with PostgreSQL 8.2.5

PostgreSQL 8.2.5 error == CreateHeartrates: migrating ================================================ — create_table(:heartrates) NOTICE: CREATE TABLE will create implicit sequence “heartrates_id_seq” for serial column “heartrates.id” rake aborted! PGError: ERROR: multiple default values specified for column “id” of table “heartrates” : CREATE TABLE heartrates (“id” serial primary key DEFAULT NULL, “user_id” integer DEFAULT NULL, “timestamp” timestamp with time zone DEFAULT…

Technology Insights

Making (and Verifying) the Migration to PostgreSQL in Rails

Install After installing PostgreSQL on Windows, I converted my Rails application from MySQL to PostgreSQL with the following steps: Create a new database in PostgreSQL Installed postgres-pr gem (Ruby driver) because the postgres gem (native driver) didn’t work. Will figure out why later on. Changed the appropriate Rails config stuff in database.yml development: adapter: postgresql…