Archive for the 'Ruby' Category

No_Knead_Bread.rake

Wednesday, December 17th, 2008

#
# Denali’s No-Knead Miracle Bread
#
 
require ‘cast_iron_dutch_oven’ # sudo gem install dutch_oven –version 3.5 Quart –source KitchenwaresStore
require ‘mixing_bowl’
require ’spatula’
 
desc "Step 1. To be performed at night"
task(:at_night) do
 
ingredients = { ‘Warm Water’ => ‘2 Cups’,
[...]

Installing RMagick2 on CentOS5

Monday, September 8th, 2008

I have just gone through hell attempting to install ImageMagick, RMagick2 on our CentOS5 server, and thought others might find this information useful.
It should have been as easy as

yum install ImageMagick
gem install rmagick

But unfortunately it wasn’t. The reason is because yum will install ImageMagick 6.2.8.0, while RMagick2 requires ImageMagick 6.3.0 or higher. Fantastic. My sysadmin [...]

Controlling Whitespace with HAML

Thursday, July 31st, 2008

When displaying certain elements as inline, the whitespace between tags does matter in your layout.
When trying to display some LI tags as inline, I really needed to spit out the tags with no whitespace in between. Unfortunately HAMLs handy-dandy tag indenting was wrecking me. It was so bad, that I resorted to calling a helper [...]

Using Fixtures with Funky Table Names

Wednesday, July 16th, 2008

If you have an AR Model whose table name does not follow the convention, and you have needed to set it explicitly using set_table_name.

class ChiliDog < ActiveRecord::Base
set_table_name ‘dogs_made_of_chili’
end

Then your test fixtures file must be named the same name as the table, not the model…
dogs_made_of_chili.yml
In your rspec, you must use the table name to [...]

Preventing Callbacks from Firing

Thursday, May 8th, 2008

I have an ActiveRecord class called JournalQuery that performs a large webservice call out to the National Library of Medicine, then caches the result in our local database. Oftentimes, this call can take well over a minute to run, which is not good for the HTTP request/response cycle. In the Rails applicatin got around this [...]

Action Caching with GET Parameters

Tuesday, February 26th, 2008

Ya ever notice how when you do page or action caching in Rails, it ignores the GET query parameters?
Sup with that?
The REST bible says you should include inputs to algorithmic resources as GET query params. Unfortunately, this means that Rails will ignore the inputs to your algorithmic resources, and you can’t cache them. Not so [...]