yuyanegishi / issue_check

0 stars 0 forks source link

★respond_toメソッドの説明 #9

Open yuyanegishi opened 5 years ago

yuyanegishi commented 5 years ago

Webサービスのサポートなしの場合、Personリストを表示するためのデータを収集するアクションは次のようになる

def index
  @people = Person.all
end

上記アクションは暗黙的にすべてのフォーマットに対応しますが、フォーマットもホワイトリストに入れることができる

def index
  @people = Person.all
  respond_to :html, :js
end