Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Cedric Fung's latest activity

Thursday, June 17 2010
4841 multiple select only keep the last one was updated in Ruby on Rails
  • Cedric Fung
    Cedric Fung commented at 10:27 AM
  • Cedric Fung
    Cedric Fung commented at 9:13 AM

    yes, this work

    select("(title, location, (latitude-#{lat})(latitude-#{lat}) + (longitude-#{lon})(longitude-#{lon})) AS distance")
    

    but if I have many scope, ve...

  • Cedric Fung
    Cedric Fung commented at 8:59 AM

    I have two named scope

    I don't wanna transfer all attributes through the mobile network, so I create a 'simple' scope

    scope :tiny, select('title, location')
    

    i...

Monday, June 14 2010
4841 multiple select only keep the last one was updated in Ruby on Rails
  • Cedric Fung
    Cedric Fung commented at 2:28 PM

    this just a demo.
    I won't use Event.select('title').select('location_title') directly. I just demonstrate the situation.

Saturday, June 12 2010
4841 multiple select only keep the last one was created in Ruby on Rails
  • Cedric Fung
    Cedric Fung created the ticket at 10:18 AM

    I use rails 3b4

    this will return location_title

    irb(main):001:0> Event.select('title').select('location_title').limit(1)
    => [#<Event location_title: "Shanghai"...
4840 to_xml doesn't work in such case: Event.select('title as t').to_xml was created in Ruby on Rails
  • Cedric Fung
    Cedric Fung created the ticket at 10:11 AM

    I use ruby 1.9.2 preview3 and rails 3b4

    The simple select works well

    irb(main):042:0> Event.select('title').limit(3).to_xml
    => "<?xml version=\"1.0\" encoding=...
Friday, June 11 2010
4810 Responder dosen't care params[:format] was updated in Ruby on Rails
  • Cedric Fung
    Cedric Fung commented at 4:56 AM

    It won't work, my log output

    this from beta3

    ======================================
    params[:format] = xml
    ======================================
    Processing by ...
  • Cedric Fung
    Cedric Fung commented at 3:49 AM

    but I use new responder syntax in rails 3

    class UsersController < ApplicationController
      respond_to :html, :mobile
      
      def index
        @users = User.all
        re...
Wednesday, June 09 2010
4810 Responder dosen't care params[:format] was created in Ruby on Rails
  • Cedric Fung
    Cedric Fung created the ticket at 5:09 PM

    I have some code like this

    before_filter :detect_browser
    
    def detect_browser
      params[:format] = 'mobile' if request.headers["HTTP_USER_AGENT"].match(MOBILE_BR...