我需要在使用RABL模板渲染后将JSON对象存储为ActiveRecord属性。我怎样才能做到这一点?
一个简单的例子是
MyModel.my_data = <output from the RABL template>
答案 0 :(得分:1)
查看https://github.com/nesquena/rabl#rendering-templates-directly
Rabl::Renderer.json(@model, 'model/show')
应该可以做到这一点。