Sha256: 29b499c09ac983543425af1f3e81566c0aae593ddb4395d6af181c9801a1c625

Contents?: true

Size: 524 Bytes

Versions: 3

Compression:

Stored size: 524 Bytes

Contents

module ActiveManageable
  module Methods
    module Update
      extend ActiveSupport::Concern

      included do
        include ActiveManageable::Methods::Auxiliary::Includes

        def update(id:, attributes:, options: {})
          initialize_state(attributes: attributes, options: options)

          @target = model_class
          includes(@options[:includes])

          @target = @target.find(id)
          authorize(record: @target)

          @target.update(@attributes)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_manageable-0.1.2 lib/active_manageable/methods/update.rb
active_manageable-0.1.1 lib/active_manageable/methods/update.rb
active_manageable-0.1.0 lib/active_manageable/methods/update.rb