RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: jarkelen
Thanks, that worked.
In my controller I have to add "@product.category_ids = params[:product][:category_ids]" to the create and update actions, otherwise nothing gets stored in the database. I don't see this in the source code of this episode. Am I forgetting something?
Already found it, I just forgot to add "has_many :branches" to the sector model. Really stupid...
For the "grouped_collection_select", where is the ":states" parameter created? I use this one (both @sectors and @branches are filled in the controller):
<%= f.grouped_collection_select(:branch, @sectors, @branches, :sector, :id, :branch, include_blank: true) %>
But receive an error:
(eval):1: syntax error, unexpected $end group.#<ActiveRecord::Relation
Thanks for another great video!
I have an issue though: I have a country which has_many regions. The region table in active admin shows the listbox with countries nicely, but it shows hash values like "Country:00x000345" instead of the actual countries. What am I doing wrong here? Thanks!