Brandon Harris

No More Comment Spam

I have been receiving a lot of comment spam. I would say around 30 comments a day. I wanted to try the simplest option possible, so I created a hidden field in the comment form that only a bot would fill out. This was working under the assumption that bots don’t read css. This worked for a little while. My spam had been reduced to under 10 comments a day, which was still high, but maintainable.

Read more →

Flickr Down, flickraw killed my app!

10/29/2009 Update Per Mael’s (Flickraw author) response, I was able to provide a better fix. FlickrawOptions = { :lazyload = true, :timeout = 2 } require 'flickraw' You can see more options in the documentation. 10/21/2009 Original Post As of the writing of this, Flickr has been down off and on for almost 2 hours. I noticed that a handful of our websites weren’t working. I traced the problem back to flickraw, there was one line in the ApplicationController: require 'flickraw' Not the best coding practice, but aside, it still needs to work without stalling on this line.

Read more →

Nested Model Forms and attachment_fu

I think that a lot of Rails developers have moved on to Paperclip . Most of us started with attachment_fu , and I am willing to wager that we still have projects floating around using attachment_fu. I updated one of these older projects to 2.3.4, and created a new form utilizing the built in nested form handling as of 2.3. My models look like this: class Article :file_system, :file_system_path = 'public/reports', :max_size = 2.megabytes, :content_type = 'application/pdf' ) validates_as_attachment end The idea is that an article can have a pdf attachment.

Read more →