Posts Tagged ‘rails’

ActiveRecord Tips

8th February, 2007

通过through多对多的结构联合查询的时候尽量用中间表的find,然后include其他两个Entity:
[...]

Rails REST的一个小Tip

31st January, 2007

To make IE(6.0) happy, place “want.html” the first block please…

  1. respond_to do |want|
  2.   want.html{
  3.     render :text=>"html"
  4.     return
  5.   }
  6.   want.xml{
  7.     render :text=>"xml"
  8.     return
  9.   }
  10.   want.js{
  11.     render :text=>"js"
  12.     return
  13.   }
  14. end

今天把xml放到了第一位,同事用IE(6.0)的返回了xml,应该是因为IE(6.0)请求的时候没有设置accept,这样就会进入第一个block…我手头没IE(6.0),也懒得抓包分析了,记住把html放第一位好了,IE(主要是7.0啦,低版本肯定更没有)的其他版本情况未知。