1 2 3 4
h = Hash.new([]) h[:a].object_id # => 9762120 h[:b].object_id # => 9762120 ...
Ruby On Assignment from array
by Markus Prinz,
July 22, 2008 16:34
1 2 3 4
a ||= Hash.new([]) # default value for non-existing keys is now an empty array, unless a was already defined a[:k] # => [] ...
1 2 3 4
module DashboardHelper def activity_message_for(object) render :partial => "#{object.class.name.downcase.pluralize}/activity" ...
1 2 3 4
a = Hash.new{|h,k| h[k] = Array.new { nil } } a[:k] # => [] ...
1
a = a[:k][0] || 1 rescue 1
1 2 3 4
module DashboardHelper def activity_message_for(object) render :partial => "#{object.class.name.downcase}/_#{object.class.name.downcase}_activity" ...
1 2 3 4
public Parameter parm(string str1, string str2) { comm.Parameters.Add(str1, SqlDbType.BigInt); ...
1 2 3 4
def self.find_by_url_like(url) # make sure url has a scheme before URI parses uri = url.match(/^https?:\/\//) ? URI.parse(url) : URI.parse("http://#{url}") ...
Ruby On Find a URL in a database
by Joe Grossberg,
July 18, 2008 21:43
I wouldn't make the query d...
Ruby On Find a URL in a database
by Joe Grossberg,
July 18, 2008 21:42
I wouldn't make the query d...


Actually you have to be car...