Author:


CakePHP model updating instead of inserting.

Posted by on February 19, 2009

Cake 1.1’s documentation is a little lacking, again.

I was having a bug where a model was updating instead of inserting, even though I was sending in an array with all of the model’s attribute except for the id. In order to get the save function to insert instead of update, I had to explicitly set the model’s id to ‘null’.

CakePHP $useDbConfig not working?

Posted by on February 13, 2009

For about a half hour i wrestled with a model’s $useDbConfig variable not working in a CakePHP project.

The answer came buried in the comments of the cakebook: the database connection has to have ‘persistent’ set to ‘false’ in order to work!

Firefox Flash Plugin Being Overwritten In Ubuntu

Posted by on August 27, 2008

In order to get debugging working with Adobe Flex Builder for Linux Alpha, I had to install the debugger version of the Flash 9 firefox plug-in.

I ran into a strange issue where after installing the Flash 9 debugger plug-in, the next instance of Firefox opened would use this correct flash version, but any other instances of firefox I opened after that would revert back to the regular version of Flash 9.

A quick post to the Ubuntu Forums revealed that running sudo apt-get remove flashplugin-nonfree fixes this without a hitch.

Simply Rails 2 Mistake: Unable to open database file

Posted by on August 27, 2008

In Chapter 4 of Sitepoint’s Simply Rails 2, you are told to run the command

sqlite3 db/development.sqlite3

then execute the sql query

CREATE TABLE `stories` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`link` varchar(255) default NULL,
PRIMARY KEY (`id`)
);

Unfortunately, following these directions you get the error: Unable to open database "db/development.sqlite3": unable to open database file.

After searching a sitepoint post I found that you have to run rake db:migrate first in the command line from the shovell directory project first, and then run this SQL query instead:

CREATE TABLE `stories` (
`id` int(11) autoincrement NOT NULL,
`name` varchar(255) default NULL,
`link` varchar(255) default NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL
,
PRIMARY KEY (`id`)
);