Ruby on Rails 質問: コントローラー内には 7 つの REST アクションがあります。それらのほとんどすべてが、xml/html または json の形式に対応しています。これが何を意味するのかわかりません。その目的を説明してください。例えば:
def index
@tweets = Tweet.all
respond_to do |format|
format.html
format.json { render json: @tweets }
end
end
html と json を含む "respond to" 部分の目的は何ですか? これらのフォーマットは何をしますか? また、xml と html の違いは何ですか? xml が表示されることもあれば、html が表示されることもあります。
ありがとうございました