AlexCs
AlexCs

Reputation: 67

Convert to hash - Ruby on rails

I have this extracted from a table

#<Section id: 12, name: "Seccion 1", created_at: "2018-07-24 15:06:34", updated_at: "2018-07-24 15:06:34", quotation_id: 62, order: 0>

but I want to convert it to hash

name_seccions.each do | section |
  section.quotation_id = event_current
  #Convert to hash
  puts section.inspect
end

Upvotes: 2

Views: 53

Answers (1)

Joao Cunha
Joao Cunha

Reputation: 772

section_hash = section.attributes

Upvotes: 1

Related Questions