How to iterate through an instance

I don't know if its efficient, or right, but ActiveRecode::Base#attributes [1]
seems to do the job

If you already know the fields, you can also do something like that :

[ :firstname, :lastname, ... ].each do |attr|
  val = model.send attr
end

Hope it will help

[1] : http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M002047