Rails

XMLHttpRequestにはJSONで結果を返す

class ApplicationController < ActionController::Base def with_json(json) if @request.xhr? @headers['Content-Type'] = 'text/javascript; charset=utf-8' render_text json.to_json else yield end end end…という機能はやっぱり既にあるのかなぁ。見…

updated_onを自動的に更新させない

class Picture < ActiveRecord::Base alias_method :update, :update_without_timestamps def touch! write_attribute('updated_on', Time.now) save end end

GWはれーるずざんまい

ほんとか。 のテストでは動くのに、本番サーバで動かそうとすると真っ白な画面しか返ってこない(Content-Length: 0)。一晩悩んで、寝て、起きて、動く部分からちょっとずつ試していったら結局、sever.username と server.groupname の設定を入れると反応しな…