Sha256: f6ba918a45cbf770207dae244dff2712b71eb94a98e7fedc53a714827add4c1e
Contents?: true
Size: 656 Bytes
Versions: 1
Compression:
Stored size: 656 Bytes
Contents
module Shopper module CartPage class UpdateOrderItems def initialize(params, order) @params = params @order = order end attr_reader :items def call return true unless iparams @items = update @items.all?(&:valid?) end private def update @order.order_items.update(iparams.keys, iparams.values) end def iparams return @iparams if instance_variable_defined?('@iparams') @iparams = @params.permit(items: [:quantity]).require(:items) rescue ActionController::ParameterMissing @iparams = nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoppper-0.1.0 | app/commands/shopper/cart_page/update_order_items.rb |