AssociationTypeMismatch: RoleType expected, got RoleType

undefined method `model_name’ for NilClass:Class

Extracted source (around line #1):

1: <%= form_for(@category) do |f| %>
2: <% if @category.errors.any? %>
3:


4:

<%= pluralize(@category.errors.count, “error”) %>
prohibited this category from being saved:

this is another error i encounterd while trying to create a new category
in my category model.

can someone pls help out on this