Ruby On messy Rails select
by Jeremy Weiskotten,
March 28, 2011 00:21
For the love of all that is...
# MODEL class Rayon < ActiveRecord::Base has_many :users ...
ActionScript On Ruby if/else statement
by Jeremy Weiskotten,
May 08, 2010 21:49
In the spirit of fat models...
# Ruby 1.8.6
pools = {1 => [1,2,3], 2 => [3,4,5], 3 => [5,6,7]}
values = pools.values.flatten
...
Ruby On Find the Intersection of Ar...
by Jeremy Weiskotten,
July 31, 2008 21:59
Here are a couple of option...
class User
named_scope :older_than, lambda { |u| { :conditions => ['age > u', u.age] } }
end
...
Ruby On How to make instance variab...
by Jeremy Weiskotten,
July 31, 2008 14:21
If you're using Rails 2.1, ...
Ruby On render partial layout
by Jeremy Weiskotten,
July 31, 2008 14:08
Partials don't use the layo...
event_times = events.collect { |event| event.datetime.strftime("%I:%M %p") }
times = times.reject { |time| event_times.include?(time.strftime("%I:%M %p'")) }
Ruby On two for loops cleanup?
by Jeremy Weiskotten,
July 31, 2008 04:31
I posted this refactoring e...
def all_shops(products) products.map(&:shops).flatten.uniq end
Ruby On Squash a collection.
by Jeremy Weiskotten,
July 07, 2008 13:47
Daniel nailed it. If you're...
def valid_param?(key) params[key] && params[key].length > 3 end ...
Ruby On Constructing a search query
by Jeremy Weiskotten,
July 07, 2008 13:44
Slight correction to Pablo'...
{
"0" => "24142",
"1" => "15151",
...
Ruby On Looking for comments on sty...
by Jeremy Weiskotten,
June 20, 2008 17:19
Instead of case/when/then, ...

For the love of all that is...