鳩舎

レースしない

Entries from 2012-02-25 to 1 day

RailsでAPIを作るときにいちいちエラーのレスポンス作るのがだるい話

なんかアクションで def index begin ... rescue => e render :json => e end end みたいにしてんのがだるいので設定する。ApplicationControllerで class ApplicationController < ActionController::Base rescue_from Exception, :with => :error_render p…

Rails respond_to default 指定

なんかうまい方法ねーかねと思って探していたのだが、なんかroutesに書くとか面倒だし、何よりroutesに書くとspecでも毎度format指定したりしないといけなくてめんどかった。んで修正 def index @items = Item.all respond_to do | format | format.any { re…