@feedbacks.each do |feedback|
data.each do |key,value|
question = feedback.send("question#{key + 1}")
...
module Enumerable # Ruby 1.8.7 introduces group_by, but the result isn't ordered. Override it. remove_method(:group_by) if [].respond_to?(:group_by) && RUBY_VERSION < '1.9' ...
class Summary < Struct.new(:klass, :options)
def range
options[:range] || options[:from]..options[:to]
...
Ruby On Rails Active Record Time Su...
by Adam,
September 03, 2008 16:21
This is completely untested...
task :status_codes do require 'action_controller/status_codes' include ActionController::StatusCodes ...
class Commentor
def comment_type
self.class.to_s.downcase
...
Ruby On Too many assignments and co...
by Adam,
August 29, 2008 21:03
I couldn't quite discern wh...
def test_web_browser
%w(Firefox/3 Firefox/2 MSIE\ 6 MSIE\ 7 Opera).detect do |agent|
request.user_agent =~ Regexp.new(agent)
...
Ruby On Code to detect the web browser
by Adam,
August 28, 2008 22:02
@Nicolás - I don't think t...
def test_web_browser
catch(:match) do
["Firefox/3", "Firefox/2", "MSIE 6", "MSIE 7", "Opera"].each do |ua|
...
<span class="bluelinks-allsmall"> <% if user.normal? %> ...
Ruby On Link to if else simple cond...
by Adam,
August 20, 2008 13:51
You should be using named r...
def sort(array)
array.inject([]) do |sorted,element|
small, large = sorted.partition { |item| item < element }
...
def self.favorite?(object)
if reflection = object.class.reflect_on_association(:favorites)
send("find_by_#{reflection.primary_key_name}", object)
...

On a forum I was reading, s...