Ask A Question


You’re not receiving notifications from this thread.

How do we show dynamic data in .erb file like from a json file?

theshashiverma asked in Rails

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 in .erb file this does not work, it works only with .rb file.

Please If you have any tutorial suggestion give me the link.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,453+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.