Using 

```
<%= collection_check_boxes(:employee, :skill_ids, Skill.all, :id, :name) %>

```

on its own works just fine in my project. This way, each employee shows all skills and if they are checked or not. 

Additionally to that, I have some categories, which the skills are related, to (Category has many Skills).

Can anyone recommend a proper way, to use the collection\_check\_boxes correctly for each category so only the skills related to the category are displayed? 
I think I am just missing the correct limitation for the "Skill.all" parameter.

Finally it should look like this, but instead of Submit buttons (by using jquery-ujs, method: put), I want those skills to be checkboxes.

<http://d.pr/i/CYHaGH>

Edit1: Skills and Categories model

```
class Category < ApplicationRecord

  has_many :subcategories, class_name: "Category", foreign_key: "parent_id"
  belongs_to :topcategory, class_name: "Category"

  has_many :skills
end

class Skill < ApplicationRecord
  has_many :employeeskillsets, foreign_key: "skill_id"
  has_many :employees, through: :employeeskillsets
  has_many :projectskillsets
  has_many :projects, through: :projectskillsets
  has_many :tagsets, dependent: :destroy
  has_many :tags, through: :tagsets

  belongs_to :category
end

```

Edit2: Still no progress. Does anybody have an idea how this could be done?

**SOLUTION:**

Ok, the solution was pretty simple. I just had to declare the collection on each category, which already was for a previous version of that app. <%= collection\_check\_boxes :employee, :skill\_ids, category.skills, :id, :name%> (category.skills was set for each instance of categories).

Thanks for the help.