top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

collection_check_box in ruby on rails?

+1 vote
366 views

I want to use collection_check_boxes (in rails 4) but i am a little bit stuck

I have 2 models:

class Supervisioncategory < ActiveRecord::Base
 has_many :phonenotes
end

and

class Phonenote < ActiveRecord::Base
 belongs_to :employee
 belongs_to :supervisioncategory
 belongs_to :trainingcategory
end

and I want to use collection_check_box for the categories shows all the categories I want, I can check them, I made the ":supervision_ids" accessible. But then nothing happend?

I think my problem is at the type of the ":supervision_ids".. integer won't work, string won't work. Please help?

posted Dec 3, 2013 by Satish Mishra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

View source as generated by Rails in your browser, and see what these checkboxes look like in HTML.

That's where I would start debugging this. My guess is that you need these to be supervisioncategory_ids, since that's what the b/t is saying the model is named. But without looking at the HTML, we won't know if your checkboxes are properly named to post as an array back to your controller.

answer Dec 3, 2013 by anonymous
...