/
strong_parameters.rb
73 lines (61 loc) 路 2.15 KB
/
strong_parameters.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# frozen_string_literal: true
module Spree
module Core
module ControllerHelpers
module StrongParameters
def permitted_attributes
Spree::PermittedAttributes
end
delegate(*Spree::PermittedAttributes::ATTRIBUTES,
to: :permitted_attributes,
prefix: :permitted)
def permitted_credit_card_update_attributes
permitted_attributes.credit_card_update_attributes + [
address_attributes: permitted_address_attributes
]
end
def permitted_payment_attributes
permitted_attributes.payment_attributes + [
source_attributes: permitted_source_attributes
]
end
def permitted_source_attributes
permitted_attributes.source_attributes + [
address_attributes: permitted_address_attributes
]
end
def permitted_checkout_address_attributes
permitted_attributes.checkout_address_attributes
end
def permitted_checkout_delivery_attributes
permitted_attributes.checkout_delivery_attributes
end
def permitted_checkout_payment_attributes
permitted_attributes.checkout_payment_attributes
end
def permitted_checkout_confirm_attributes
permitted_attributes.checkout_confirm_attributes
end
def permitted_order_attributes
permitted_checkout_address_attributes +
permitted_checkout_delivery_attributes +
permitted_checkout_payment_attributes +
permitted_checkout_confirm_attributes + [
line_items_attributes: permitted_line_item_attributes
]
end
def permitted_product_attributes
permitted_attributes.product_attributes + [
product_properties_attributes: permitted_product_properties_attributes
]
end
def permitted_user_attributes
permitted_attributes.user_attributes + [
bill_address_attributes: permitted_address_attributes,
ship_address_attributes: permitted_address_attributes
]
end
end
end
end
end