Flowdock

Good notes posted by FooBarWidget

RSS feed
July 1, 2008
3 thanks

:case_sensitive is on by default?

In contrast to what the documentation said, :case_sensitive seems to be on by default. This is the case with MySQL at least, I’m not sure about other databases.

June 29, 2008
5 thanks
June 25, 2008
4 thanks

collection.exists?(conditions)

The created association method also supports the ‘exists?’ method, similar to ActiveRecord::Base#exists?

has_and_belongs_to_many :categories
...
categories.exist?(1)   # Check whether there's a relation with a Category
                       # object whose id is 1.
categories.exist?(:id => 1)    # ditto
categories.exist?(['id', 1])   # ditto
categories.exist?(:name => 'Anime')