yep, didn't see that exclamation point there at the end.

agreed.  thx! :)


On Mon, Jul 22, 2013 at 7:33 AM, Paul Annesley <notifications@github.com>wrote:

> In lib/flip/database_strategy.rb:
>
> > @@ -23,17 +23,19 @@ def switchable?
> >      end
> >
> >      def switch! key, enable
> > -      @klass.find_or_initialize_by_key(key.to_s).update_attributes! enabled: enable
> > +      record = @klass.where(key: key.to_s).first_or_initialize
> > +      record.enabled = enable
> > +      record.save
>
> The semantics here are slightly different.
> Replacing record.save with record.save! would solve that.
>
> Alternatively, I think first_or_initialize and friends can take
> non-finder attributes somehow, which are only used in the “or initialize”
> case…? But I like the simpler approach you have… less AR voodoo.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/pda/flip/pull/8/files#r5317267>
> .
>