Hi Brightspark.
You've got a complex model relationship there! It's quite difficult to
follow for someone that doesn't know the problem well.
In the future, consider removing any parts that are not essential to
understanding the problem from your gists.
I have not used dependent_collection_select with formtastic. The
chances for it working "out of the box" with it are ... very low. You
will probably have to monkeypatch Formtastic in order to accept
dependent_collection_select as a valid order; I'm not sure about how.
This could be what is giving you the "wrong number of arguments (6 for
2)." error.
Dependent you can make lots of dependent selects depend on the same
field. This just means that more than one javascript "observer" will
be linked to the "observed" field. This should make no difference.
The difference however is that dependent selects work on 1 dependency
only. I'm not sure, but it seems that in your example you need your
dependent selects have 2 or 3 dependencies instead of one. They are
not prepared for that.
You *could* make them depend on a hidden field that concatenated two
values, but that would be ugly, inelegant and error prone. If your
selects depend on two or more fields, then I recommend you not to use
my gem; update the relevant portions using AJAX instead. You will have
to create some partial views and add some divs, as well as modify/add
1 controller action, but the result will be more satisfying (and rail-
y)
One last thing: when adding conditions "as a string", you should
include your table names. So, instead of this:
:conditions => ["type = ?", "Product"]
I recommend you to do this:
:conditions => ["categories.type = ?", "Product"]
Otherwise you will get a SQL error when you try to use that named
scope in joins with other models that also have a "type" column.
Regards, and good luck!