Thanks.

I forgot to mention that one solution is discussed on

http://stackoverflow.com/questions/9174513/rails-has-many-through-form-with-checkboxes-and-extra-field-in-the-join-model/9191867#9191867

When I try this approach I got an error message from inside the original
routine below:

Couldn't find Questionnaire without an ID

(In my case Product is User, Category is Form and Categorization is
Questionnaire.)

def initialized_categorizations # this is the key method
    [].tap do |o|
      Category.all.each do |category|
        if c = categorizations.find { |c| c.category_id == category.id }
          o << c.tap { |c| c.enable ||= true }
        else
          o << Categorization.new(category: category)
        end
      end
    end
  end
...

My question is what the error line tries to do in detail.

Anyway, I'm surprised that for this common problem there is still no
reasonable solution available.

Regards
Bodo

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to