How to list all fields and their values in the table?

There is a table. It has a record.

For example, receive data of this record like this:
@news = News.find(params[:id])

How to display all keys and their values for this record?

Tried using "each" - did not work:
undefined method `each'
July 12th 19 at 16:48
1 answer
July 12th 19 at 16:50
Solution
@news = News.find(params[:id])
@news.attributes.each { |k, v| puts "#{k} - #{v}" }
How to display all keys and their values for this record?
- myrn commented on July 12th 19 at 16:53
I mean a single record. It's in the database key - value. Here you need this list. - myrn commented on July 12th 19 at 16:56
: fixed - Jacques.Renner51 commented on July 12th 19 at 16:59
: super. Thank you :) - myrn commented on July 12th 19 at 17:02

Find more questions by tags Ruby on RailsPostgreSQL