I have an application that I am using Active Record to access a database. I'm trying to take the information and put it into a hash for later use.
Here is basically what I am doing.
require 'active_support'
@emailhash = Hash.new
emails = Email.find(:all)
emails.each do |email|
email.attributes.keys.each do |@column|
@emailhash[email.ticketno] || Hash.new
@emailhash[email.ticketno] = email.@column
end
end
The line that doesn't work is:
@emailhash[email.ticketno] = email.@column
Is there any way that I can do this properly? Basically my goal is to build a hash off of the values that are stored in the table columns, any input is appreciated.