【发布时间】:2011-06-19 20:30:35
【问题描述】:
我希望有一个通过 AJAX 创建/更新的模型。你如何在 Ruby on Rails 中做到这一点?
另外,更具体地说:如何在 RoR 中输出 JSON?
def create
response = {:success => false}
@source = Source.new(params[:source])
if @source.save
response.success = true
end
render :json => response.to_json
end
【问题讨论】:
标签: ruby-on-rails json