Notes posted by slippyd

RSS feed
April 3, 2010
0 thanks

:autosave => false vs. :autosave => nil

The documentation above mentions that :autosave => true always saves the association and that it’s “off” by default. What it doesn’t mention what they mean by “off”.

  • :autosave => nil (the default “off” behavior) will still autosave the association if it has changed or is a new record.

  • :autosave => false seems to prevent autosaving of the association, even if it has changed.

I’ve found :autosave => false to be useful behavior when trying to prevent cyclical dependency loops; there are likely other useful use cases out there.

December 18, 2009
4 thanks

Version Ranges

To specify a version range, use array syntax like this:

config.gem 'paperclip', :version => ['>=', '< 3.0']

The example will, of course, match any version or newer up until (not including) 3.0 or later.