I am using formtastic-2.2.1, Spree 1.3 and Rails 3.2.18.
This in my form input that I am having issues with:
= f.input :collection_products, :as => :check_boxes, :label => false, :collection => Spree::Product.order("name").all
The issue I am having is when I create a new collection_page and hit edit previously selected items are unselected in the edit form, all the other inputs are working as expected.
I've tried it with a simple collection, like :collection => ["x", "y", "z"]
ie:. If I select "x", "y" and try to edit it, they are no longer selected.
Collection Page model:
class CollectionPage < ActiveRecord::Base
has_many :spree_products, :class_name => Spree::Product
and added belongs_to :spree_collection_pages
to product_decorator.rb
I'm having the exact same issue as formtastic check_boxes using collection not saving checked items in edit form
Would be awesome if someone can help out!
Thanks a lot.
I ended up solving it by using simple_form instead and did the following on my form:
= f.association :spree_products, :collection => Spree::Product.order("name").all, :prompt => "Choose products for this collection"