8月 18th, 2012 • rails, Ruby 最近Railsにはformatというパラメーターがある。 formatの種類には、基本的に、html、xml、jsonがある。 コントローラーのアクションを実行すると、必ず、formatパラメーターがわたる。 実際にrailsアプリをつくり、試してみる。 #TestというRailsアプリをつくる。 $ rails new Test #Testアプリに移動する。 $ cd Test # Entriesコントローラーをつくり、indexアクションをつくる。 $ rails g controller Entries index rails s でwerbrickを動かして、http://localhost:3000/entries/index.html に接続する。 indexアクションに、formatパラメーターが何かわかるようにログ出