문제

Should I render a Partial with the information of the current data I have, or send a JSON and let javascript create the elements, with the information found in the JSON?

What's safer and more efficient?

도움이 되었습니까?

해결책

This is really a matter of personal preference. There's no simple single answer as to whether you should use a javascript framework (or even roll your own) on the front end, or to use various rails templates to send the data.

I think if you're buiding the entire front end in a javascript framework then stay consistent with that. If you're building most of the site with erb or haml templates then stick with that. I'd avoid mixing the two too much, personally.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top