Serve static json object file in rails

How to serve static JSON object from file in rails? (I want to access it when calling ajax)?

What is the best method?

+3
source share
1 answer

Just put what you want to visualize in a variable, then use render :json => variable
There are reasonable defaults for lists, dicts, etc.

See this: http://guides.rubyonrails.org/layouts_and_rendering.html

Item: "2.2.8 Rendering JSON"

0
source

Source: https://habr.com/ru/post/918719/


All Articles