Sha256: b5d89bbb86dee560c6d531a1f56b2c8c83bc343da35895f293ec6183cfd4721f

Contents?: true

Size: 964 Bytes

Versions: 34

Compression:

Stored size: 964 Bytes

Contents

module Sequel
  module Plugins
    # The scissors plugin adds class methods for update, delete, and destroy.
    # It is so named because this is considered dangerous, since it is easy
    # to write:
    #
    #   Album.delete
    #
    # and delete all rows in the table, when you meant to write:
    #
    #   album.delete
    #
    # and only delete a single row.
    #
    # This plugin is mostly useful for backwards compatibility, and not
    # recommended for use in production.  However, it can cut down on
    # verbosity in non-transactional test code, so it may be appropriate
    # to use when testing.
    #
    # Usage:
    #
    #   # Make all model subclass run with scissors
    #   Sequel::Model.plugin :scissors
    #
    #   # Make the Album class run with scissors
    #   Album.plugin :scissors
    module Scissors
      module ClassMethods
        Plugins.def_dataset_methods(self, [:update, :delete, :destroy])
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
sequel-4.30.0 lib/sequel/plugins/scissors.rb
sequel-4.29.0 lib/sequel/plugins/scissors.rb
sequel-4.28.0 lib/sequel/plugins/scissors.rb
sequel-4.27.0 lib/sequel/plugins/scissors.rb
sequel-4.26.0 lib/sequel/plugins/scissors.rb
sequel-4.25.0 lib/sequel/plugins/scissors.rb
sequel-4.24.0 lib/sequel/plugins/scissors.rb
sequel-4.23.0 lib/sequel/plugins/scissors.rb
sequel-4.22.0 lib/sequel/plugins/scissors.rb
sequel-4.21.0 lib/sequel/plugins/scissors.rb
sequel-4.20.0 lib/sequel/plugins/scissors.rb
sequel-4.19.0 lib/sequel/plugins/scissors.rb
sequel-4.18.0 lib/sequel/plugins/scissors.rb
sequel-4.17.0 lib/sequel/plugins/scissors.rb
sequel-4.16.0 lib/sequel/plugins/scissors.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/scissors.rb
sequel-4.15.0 lib/sequel/plugins/scissors.rb
sequel-4.14.0 lib/sequel/plugins/scissors.rb
sequel-4.13.0 lib/sequel/plugins/scissors.rb
sequel-4.12.0 lib/sequel/plugins/scissors.rb