from rails api:
http://apidock.com/rails/ActiveRecord/Associations/ClassMethods/has_and_belongs_to_many
has_and_belnogs_to_many: Specifies a many-to-many relationship with another class. This associates two classes via an intermediate join table. Unless the join table is explicitly specified as an option, it is guessed using the lexical order of the class names. So a join between Developer and Project will give the default join table name of “developers_projects” because “D” outranks “P”.
so you need to make sure you have a table called
elements_muscle_groups
with element_id: integer
and muscle_group_id:integer