Flowdock

Notes posted by bquorning

RSS feed
August 16, 2010
0 thanks

update_all and serialized attributes

If you use update_all to change an attribute marked as serialized ( using ActiveRecord::Base.serialize ), you need to call to_yaml yourself:

User.update_all({ :preferences => { :first_name => 'John',
                                     :last_name  => 'Doe' }.to_yaml })
February 25, 2010
1 thank

Redirect...

See ActiveRecord::ConnectionAdapters::TableDefinition#column for details of the options you can use.

February 25, 2010
0 thanks

See documentation for the class method

Since Rails version 2, this instance method no longer exists.

You may be looking for its namesake class method, ActiveRecord::Base.method_missing

January 16, 2010 - (>= v2.2.1)
8 thanks

Pretty way to test for current environment

You can check your current Rails environment using nice methods such as:

Rails.env.development?
Rails.env.test?
Rails.env.production?
Rails.env.your_custom_environment?
September 7, 2009
0 thanks

:popup gotcha in IE

If your popup title contains spaces or escaped HTML characters, Internet Explorer (at least 6/7) will not pop up a new window but open the link in the existing browser window.

June 10, 2009 - (>= v1.0.0)
5 thanks

Have the check_box checked by default

To have the check box checked by default, pass either :checked => true or :checked => 'checked' in the options. See ActionView::Helpers::InstanceTag#to_check_box_tag for details.

March 26, 2009
1 thank