虽然我意识到应该在视图中使用一个助手,但在构建JSON对象返回时,我需要在控制器中使用一个助手.
有点像这样:
def xxxxx
@comments = Array.new
@c_comments.each do |comment|
@comments << {
:id => comment.id,
:content => html_format(comment.content)
}
end
render :json => @comments
end
如何访问我的html_format
助手?