November 2008
1 post
3 tags
JSON output in Rails 2.1
I just came across a change in Rails 2.1 when converting an ActiveRecord object to JSON. The JSON output now includes the ActiveRecord model name in the object so if you have a user model and convert it to json, you get the following:
user = User.find(1)
user.to_json
{"user" : {"name" : "John Doe", "id" : 1}}
This becomes a pain when you’re pulling this data via AJAX and you’re...
1 tag
The Ext3 filesystem sub-directory limit
I recently came across a problem on a site where a client could no longer upload images through their site. After digging through the logs, I found the relevant error:
Errno::EMLINK (Too many links - /usr/lib/ruby/1.8/fileutils.rb:243:in `mkdir’
This error was occurring when the system tried to make a new directory to store the uploaded images in. After researching (googling) the error,...