item.id
returns value nil
(i.e. has not been assigned id
yet), therefore you get the error:
missing required keys: [: theme_id]
To solve it, verify that the object item
is saved before; most likely you have generated the @category
object and assigned the themes
without saving the main object (ie with @category.new
) and, therefore, the id
has not yet been generated so it has value nil
.
Correcting my previous answer, the helper new_category_theme_comment_path
if can receive parameters such as hash and as objects of ActiveRecord
(in addition to numbers), therefore any of the following options is valid:
<!-- con hash -->
<%= link_to “show”, new_category_theme_comment_path(item.category_id, theme_id: item.id) %>
<!-- con número -->
<%= link_to “show”, new_category_theme_comment_path(item.category_id, item.id) %>
<!-- con objeto AR -->
<%= link_to “show”, new_category_theme_comment_path(item.category_id, item) %>