Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
5 total  XML / RSS feed 

printing debug information in development mode in Rails

// description of your code here

logger =
logger.debug ("title: #{@attr.get('title')}")
logger.debug("small_image: #{@images.search_and_convert('smallimage')}")

debug print Hpricot xml object

// description of your code here


/tmp/mysql.sock file not found

first finds where your .sock file is

second sets a symbolic link to the sock so Rails' default location for the sock is cool

mysql_config --socket

sudo ln -s  /var/run/mysqld/mysqld.sock /tmp/mysql.sock

Adding an error to the model

// description of your code here
How to manually add errors to the model
Should probably be done as part of the validate callback

self.errors.add :field_name, "isn't as it should be"

Print PHP errors to screen

We keep error reporting off for safety reasons, but if you're baffled as to why something's not working, you can temporarily view errors by popping this into your script:


And fer pete's sake remember to remove it afterwards.
« Newer Snippets
Older Snippets »
5 total  XML / RSS feed