Flowdock

Good notes posted by zubin

RSS feed
March 25, 2011
4 thanks

How to specify :only_path when non-hash options

When passing in an object, as opposed to a hash, you can’t do this because url_for accepts one argument:

url_for(post, :only_path => true)

Instead, do this:

polymorphic_url(object, :routing_type => :path)
February 21, 2011 - (>= v3.0.0)
8 thanks

case-insensitive uniqueness

For case-insensitive uniqueness:

validate :username, :uniqueness => {:case_sensitive => false}
July 20, 2010
4 thanks

When scripts don't end in .js

For example, Google Custom Search’s URL is http://www.google.com/jsapi

It’s an ugly hack, but works:

= javascript_include_tag('http://www.google.com/jsapi').sub('.js', '')