1 2 3 4
def self.valid?(key) return false unless h = find_by_key(key) h.invitation_details_count < h.total ...
Ruby On Better Nest Ifs
by Dan Kubb,
April 13, 2008 04:26
1 2 3 4
def create subscribers = [] params[:recipients].to_s.each_line do |line| ...
Ruby On Importing large collection ...
by Dan Kubb,
March 22, 2008 21:31
Here is how I would write t...
1 2 3 4
def squarebutton(name, options = {}, html_options = {}) html_options[:class] = [ html_options[:class], 'squarebutton' ].compact * ' ' link_to content_tag(:span, name), options, html_options ...
Ruby On Adding default html option ...
by Dan Kubb,
February 29, 2008 17:17
This will add the "squarebu...
1 2 3 4
before_save :titlecase_fields def titlecase_fields ...
Ruby On ActiveRecord Attributes rej...
by Dan Kubb,
February 28, 2008 18:22
This iterates over just the...
1 2 3 4
[ :planned, :actual ].each do |type| define_method("#{type}_percent_complete") do return 0 if send("#{type}_complete_in_dollars").nil? ...
Ruby On Same methods, different Act...
by Dan Kubb,
January 08, 2008 20:06
Here's an alternate approac...


This refactoring uses a gua...