Monthly Archives: August 2007

UJS; RJS versus POJS; Prototype Stack versus JQuery Stack

I am accustomed to using Unobtrusive JavaScript (UJS) in my apps. UJS dynamically adds event handlers to the DOM. These event handers implement behaviors via DOM manipulations and XMLHttpRequests (XHR’s). This approach is in contrast to the historical approach of … Continue reading

Posted in AJAX, RJS templates, Ruby on Rails, script.aculo.us | 4 Comments

Logging From Your Rails Models

update 2010/10/16: RAILS_DEFAULT_LOGGER is deprecated. I’m using ActiveRecord::Base.logger now as in: ActiveRecord::Base.logger.debug “value of x is #{x}” read on for the older solution… I just spent five minutes figuring out how to log from a model class in Rails (or … Continue reading

Posted in Ruby on Rails | 2 Comments

Ruby Symbol#to_proc — Don’t Forget It!

This is your code: puts %w{A B}.collect{|e| e.downcase}.inspect This is my cooler code: puts %w{A B}.collect( &:downcase).inspect This is how the Ruby Extension Project makes it work: class Symbol def to_proc proc { |obj, *args| obj.send(self, *args) } end end … Continue reading

Posted in Ruby on Rails | 1 Comment