Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个非常简单的任务,但很困惑。
我需要我的行动以非常简单的 JSON 响应:
{"valid": true}
我需要在控制器中写什么?
render :json => ......
render :json => { valid: true }
Rails 应该to_json自动调用。
to_json
你有没有尝试过:
render :json => {"valid" => true}