top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

collection_check_box in ruby on rails?

+1 vote
175 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 Google+ Share Button LinkedIn Share Button Multiple Social 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...