On 25-02-2014 20:14, Jeremy Evans wrote:
On Tuesday, February 25, 2014 10:01:05 AM UTC-8, Rodrigo Rosenfeld Rosas wrote:

    Em sábado, 1 de fevereiro de 2014 15h38min29s UTC-2, Jeremy Evans
    escreveu:

        Sequel 4.7.0 has been released!

        = New Features

        ...* An update_or_create plugin has been added, for updating a
        matching
          object if one exists, or creating an object if it does not. For
          example, the following code will update the number of copies
        sold
          for album with the name 'Hello', or it will create an album with
          the name 'Hello' and 1000 number of copies sold:

            Album.plugin :update_or_create
            Album.update_or_create(:name=>'Hello') do |album|
              album.num_copies_sold = 1000
            end

          You can also use a shorter form of this, with two hashes:
            Album.update_or_create({:name=>'Hello'},
        {:num_copies_sold=>1000})

          This plugin also adds a method named find_or_new, which does the
          same thing as update_or_create, except it doesn't persist any
          changes.


    This is all great, but it would be even better if it supported the
    raise_on_save_failure option... ;)

    For now I need to use find_or_new(...).save_changes
    raise_on_save_failure: true

    Thank you for this great release :)


raise_on_save_failure is true by default, so unless you change the default, you don't need to worry about it. :)


Ah, great, I wasn't aware of that :) Have no idea why I always assumed it was false by default :)

Thanks,
Rodrigo.

--
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to