So, I create a spree extension in which I have my own attribute, which I added to Spree::Shipment , and added input during the verification process, the problem is that my attribute is not part of the allowed attributes for shipments and it is unclear how to add it to allowed attributes. I found a conversation on this pull req that says to use
Spree::PermittedAttributes.shipment_attributes << :my_custom_attribute
However, it is not clear where I can put this ??
"Oh, put it in spree.rb "
This will not help. I tried putting this code in
lib/spree.rb lib/spree/permitted_attributes.rb lib/spree_decorator.rb lib/spree/permitted_attributes_decorator.rb
( as suggested here ), and all this leads to the fact that the error causing the complaint about shipment_attributes is not defined (so the code is supposedly executed before the main file that defines PermittedAttributes is evaluated), or just nothing happens. Where should I put this code to add my attribute to the list of allowed attributes?
Edit: since this seems incomprehensible to people, I tried all the things listed in the links I posted. Telling me to try something in them is pretty annoying. Stop doing this.
ruby ruby-on-rails-4 strong-parameters spree
Shelvacu
source share