How to edit partial without the need for "_" in front of the file name? Is there a parameter that I can call so as not to use it?
This problem arose using RABL and Backbone. Using RABL requires a file in my views, such as index.json.rabl. But, when I use JSON directly on the page load (as usual with Backbone), I have to call the file "_index.json.rabl". These 2 files are the same, you just need to have different names. I want to use only one file, index.json.rabl, and make the render () function look for that file name without "_".
=> EDIT
The standard solutions described below do not work. This is probably a RABL problem? The code below always refers to the file views / countries / _index.json.rabl.
In my .erb file
countryList.reset(<%=get_json("countries", "index", @countries)%>);
In application_helper.rb file
def get_json(view_path, view_action, object)
path = view_path + '/' + view_action + ".json"
return raw(render(path, object: object, :formats => [:rabl]))
end
source
share