In Rails 2
foos = Foo.all :select => "name, value",
:conditions => ["name in (?)", %w(bar other_bar)],
:limit => 2
In Rails 3
foos = Foo.where("name in (?)", %w(bar other_bar)).select("name, value").limit(2)
Тогда
foo = Hash[foos.map { |f| [f.name.to_sym, f.value] }]
или
foo = foos.inject({}) { |h, f| h[f.name.to_sym] = f.value; h }
или в Ruby 1.9
foo = foos.each_with_object({}) { |f, hash| hash[f.name.to_sym] = f.value }