Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

rails to json

// Used in Rails 6
// Inside your template you can have a Model converted in Json (Javascript) 
// adding:

const JavascriptVariable = <%=raw @model.to_json() %>;
 
PREVIOUS NEXT
Tagged: #rails #json
ADD COMMENT
Topic
Name
1+9 =