Category Archives: ruby

A Better Solution For Partial View Controllers

A few days ago, I wrote about using the Cells gem to create an encapsulated segment of my app, with view and controller, etc. Well, this didn’t work out so well after all. Aside form the initial problem of `content_for` … Continue reading 

| Comments Off

Cleaning Up Rails Helper Methods With A Helper Class: Good Idea, Bad Idea, Or ‘Meh’?

I found myself writing a very ugly helper method in my rails ApplicationHelper module: def render_program_dashboard(patient_program) key = patient_program.program.key content_for :css do stylesheet_link_tag “#{key}/patient_program” end dashboard_instance = nil dashboard_class_name = “#{key.to_s.classify}::ProgramDashboard” begin dashboard_class = dashboard_class_name.constantize dashboard_instance = dashboard_class.new(patient_program) rescue Rails.logger.info … Continue reading 

| Comments Off

Cells: Partial Controllers And Views For Rails 3

I’ve got a sort-of meta-application that I’m building in Rails 3 for a client. The core of the application is a framework on which we build various “Programs” that a patient can participate in. On the Patient Profile screen, a … Continue reading 

| Comments Off

Hacking Websites with Ruby and Nokogiri

Every once and a while we get a chance to use software for the good of others. Last week I had just that opportunity. The story begins with a website called Cinematical. Cinematical is a website dedicated to movies of … Continue reading 

Also posted in Uncategorized | Comments Off

Solving Some SSH Issues For Deploying Rails Apps

So you think “The Rails Life” is all unicorns, rainbows and glitter? Yeah. Guess again. Right now it feels more like a glitter cannon shredding a unicorn into a rainbow colored bloody pulp… Joey and I are deploying our rails … Continue reading 

| 3 Comments

Providing Unauthenticated API Access To An Authenticated/Authorized Controller In Rails 3, With Devise And CanCan

My current Ruby on Rails app defaults to every page and controller action in the system requiring authentication. If you’re not logged in, you don’t get to do anything other than see the login page. Once you are logged in, … Continue reading 

Also posted in git, gitosis | 6 Comments

Installing Ruby 1.8.6 And RubyGems On OSX (Snow Leopard) With RVM

RubyGems no longer supports Ruby v1.8.6, so when I tried to install 1.8.6 on my Macbook, via RVM, I ran into this nice little error message: The interesting bit is that ruby itself installed. It’s only RubyGems that didn’t install … Continue reading 

Also posted in git | 4 Comments

Validating Xml Against XSD Schema In IronRuby

There’s a thousand examples of how to validate an xml document against an xsd schema in C# around the web, but I had a hard time finding one that worked in IronRuby. So I translated some of the C# examples … Continue reading 

Also posted in members | Comments Off

How To Have Bundler Load A Gem From The Vendor Folder Into A Rails 3 App

I have a rails 3 app that needs some specific functionality that is built into a gem. Unfortunately, the current gem that is published on RubyGems.org only works with rails 2. I was able to get the gem to work … Continue reading 

Also posted in git | 4 Comments

Responding To Growl Notification Clicks With MacRuby

In my last post, I detailed the process of setting up a MacRuby app to send Growl notifications. To get even more mileage out of Growl, though, it’s a good idea to response to various interactions with the notifications that … Continue reading 

Also posted in bash, gems, windows | 2 Comments