How do we show dynamic data in .erb file like from a json file?
I have a view file index.html.erb in my view folder and there I am showing some data in the form of Table(bootstrap table) and this is a static table so I had to write so many lines of HTML for this table.
Now, I want to a show the data in Table in a dynamic form, means I want to keep all the data in a JSON file and want to parse that data in my view file and fetch all the data by having a loop over it so I just have one block of HTML and all the table data should create through that block of code.
Or is there any other method to do this means getting the data dynamically in ruby on rails?
I did google, but everywhere I found this with ruby, but I don't know how to do this in rails, I followed this https://hackhands.com/ruby-read-json-file-hash/ in .erb file this does not work, it works only with .rb file.
Please If you have any tutorial suggestion give me the link.