Search code examples
ruby-on-railsspreestrong-parameters

Spree 2.1 strong parameters


Is there a easy way to add a new permitted parameter to controllers in Spree without altering the defaults ?

I'm trying to change the orders_params method in OrdersController.


Solution

  • You don't need to override anything, you have to do this in your spree initializer

    To add a strong param to products controller...

    Spree::PermittedAttributes.product_attributes << :new_attribute
    

    and so on..

    check this file: https://github.com/spree/spree/blob/master/core/lib/spree/permitted_attributes.rb?source=c

    or this blog post: http://blog.crowdint.com/2014/06/24/how-to-add-custom-attributes-in-spree.html