I made a table component using react js, which uses columns to display data (which works fine with other data). For example, column 1 would show the title, column 2 the year, and column 3 the format.
Here is an example of my JSON:
{"movies": [{"title": "Iron Man", "year": "2008", "format": "DVD"}, {"title": "Iron Man 2", "year": "2010", "format": "DVD"}, {"title": "Iron Man 3", "year": "2013", "format": "DVD"}]}
Here is my code to populate the table, but it does not seem to work:
@movieList = #Makes a call to my mock API to get list of movies
@movies = Array.new
@movieList.each do |item|
@movie = Hash.new
@movie[:column1] = item[:title]
@movie[:column2] = item[:year]
@movie[:column3] = item[:format]
@movies << @movie
end
I need some advice to overcome a "no implicit conversion of symbol into integer error" I get. Could anyone offer some advice and point out where I am going wrong?