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.

Szymon Nowak's latest activity

Wednesday, April 27 2011
3521 Add conditional counter cache was updated in Ruby on Rails
  • Szymon Nowak
    Szymon Nowak commented at 9:37 AM

    Wouldn't actually moving counter_cache declaration from belongs_to to has_many solve this problem?

    class Post
      has_many :likes, :class_name => "Vote", :condit...
Monday, April 11 2011
6450 Arel generates invalid SQL when using DISTINCT ON in PostgreSQL was updated in Ruby on Rails
  • Szymon Nowak
    Szymon Nowak commented at 2:10 PM

    I'm for #2 in a short term, because right now it doesn't work at all.

    However, having e.g. the following requirement: "Display the latest post posted by each us...

Thursday, March 24 2011
6618 Inconsistent behavior of collection.new vs collection.build was updated in Ruby on Rails
Thursday, March 03 2011
6512 AR scopes behave differently than class methods was updated in Ruby on Rails
  • Szymon Nowak
    Szymon Nowak commented at 4:42 PM

    Ok, the example with email was maybe not very fortunate, but in case of WHERE IN clause it really is not consisten:

    class User < ActiveRecord::Base
      scope :a,...
  • Szymon Nowak
    Szymon Nowak created the ticket at 3:06 PM

    Rails 3.0.5:

    class User < ActiveRecord::Base
      scope :a, where(:email => "a")
      scope :b, where(:email => "b")
      
      def self.c; where(:email => "c"); end
      def...
Thursday, February 24 2011
6450 Arel generates invalid SQL when using DISTINCT ON in PostgreSQL was updated in Ruby on Rails
  • Szymon Nowak
    Szymon Nowak commented at 10:03 AM

    Just small update - it seems that the column in DISTINCT ON must match the first column in ORDER BY clause:

    This works fine:

    SELECT DISTINCT ON(countries.name)...
Tuesday, February 22 2011
6246 Time.zone is broken in most every version of rails including 3.x was updated in Ruby on Rails
  • Szymon Nowak
    Szymon Nowak commented at 3:00 PM
    1. Rails store the current time zone in Thread.current[:time_zone], so it is possible and very likely that on production server if you change time zone in one re...

Friday, February 18 2011
6450 Arel generates invalid SQL when using DISTINCT ON in PostgreSQL was created in Ruby on Rails
  • Szymon Nowak
    Szymon Nowak created the ticket at 3:52 PM

    For the following query

    Country.select("DISTINCT ON(countries.id) countries.*").joins(:cities).order("countries.name ASC")
    

    Arel generates the following SQL (i...

Sunday, January 30 2011
6347 Section 2.5 of I18n guide for Rails 3.0 is outdated was created in Ruby on Rails