Archive for January, 2009

  • New Rails plugin - Quick Scopes - January 27th, 2009

    I’ve just release a new Rails plugin called Quick Scopes that adds some generic named_scopes to your models to quickly manipulate the results you receive from associations.
    It’s great to have easy access to methods to get all associations but sometimes you need to manipulate how you receive those results.
    Included named_scopes:

    limit - to limit the number [...]

  • How to protect downloads but still have nginx serve the files - January 13th, 2009

    I’ve just been working on a project where a number of downloads needed to be restricted to specific users. I needed to authenticate the user and then allow them access to the file. This is not too difficult in rails:
    def download
      if authenticated?
        send_file #{RAILS_ROOT}/downloads/images/myfile.zip’
      end
    end
    The problem with this is that if the file [...]

  • How to make a custom form builder in Rails - January 6th, 2009

    A quick run through creating a custom form builder in rails. This particular form builder will inline error messages into your form labels.

  • How to migrate a Rails app from using Attachment_fu to Paperclip - January 2nd, 2009

    A run through on how to migrate a project from using Attachment_fu to Paperclip as attachment plugin. This includes all the steps for a seamless upgrade including changing the file layouts on Amazon S3.