Answer the question
In order to leave comments, you need to log in
How to list all fields and their values in a table?
There is a table. It has notes.
For example, I get the data of this record like this: @news = News.find(params[:id])
How to display all the keys and their values of this record?
Tried with "each" - didn't work:
undefined method `each'
Answer the question
In order to leave comments, you need to log in
@news = News.find(params[:id])
@news.attributes.each { |k, v| puts "#{k} - #{v}" }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question