My Profile Photo

rubycoloredglasses


I'm Jason, a web applications developer in the San Francisco Bay area.


  1. Using URL Helpers in Models or Rake Tasks

    If for some reason you need to use URL helpers which are based on the routes you’ve defined in Rails 3.1, simply add the following to the model method or rake task: …


  2. Building a Query String from a Hash with Rails 3

    I have a model has a method that generates and stores a cached link to it’s own view for use in mailers. Under Rails 2 the method which generated this link created the beginning of the URL based on the owner of the object (this is a multi-domain system I’m working on), however it required that a hash of parameters be included in the link. …


  3. Rails 3 Autoloading with Namespaced Models

    I’m working through an upgrade from Rails 2.3.8 to Rails 3.1, and a set of name spaced models that I setup are giving errors when I run a certain Rake task that relies on them. I looked into the issue and it appears that I need to learn the way Rails 3 loads models. …


  4. Form Fields not Displaying with Formtastic

    The Rails project I’m currently working on uses Formtastic, a Rails form builder plugin. The projects description says “Formtastic is a Rails FormBuilder DSL (with some other goodies) to make it far easier to create beautiful, semantically rich, syntactically awesome, readily stylable and wonderfully accessible HTML forms in your Rails applications.” I wasn’t sure what DSL means, but found in the projects wiki on the About page that it stands for Domain Specific Language. …


  5. Adding Event Listeners to Google-Maps-for-Rails Markers

    I’m currently working on a Ruby on Rails project that was setup under Rails 2, and we’re upgrading it to Rails 3 via a separate branch. …


  6. Redirect_to not working

    I was just working on a Ruby on Rails controller method that receives information from the previous form via HTTP POST. I coded it so that if certain form variables weren’t present it would set a flash message and redirect to the form page. I tried and tried and still the redirect wasn’t working. I reset my web server, and even restarted my computer, but stil this didn’t resolve the issue. …


  7. Advanced Use of Will_Paginate

    I’m building an index of contacts, displayed with paginated links provided by will_paginate. …


  8. Getting File object for Paperclip Attachment via S3

    I’m working on a project where we are using the Paperclip plugin for Ruby on Rails for file handling and associations with other models. …


  9. Issues with MacPorts After Upgrading to OS X Lion

    I realized this morning that I was having dependency issues with ImageMagick on my Mac, which I installed using MacPorts. I had recently upgraded to Mac OS X Lion, so it made sense that I needed to update the software to resolve the issues, much like I had when I upgraded to Snow Leopard. …


  10. Error: 'unintitialized constant MySQL' with Rails 3 on Snow Leopard Mac

    I just installed Rails 3 on my iMac, which is running Snow Leopard. I’m trying to build a web hosting website/billing system/management system. I configured the app to use MySQL in /config/database.yml like so …