I have the following models:
user.rb
has_and_belongs_to_many :comps
comp.rb
has_and_belongs_to_many :users
And my comps_controller.rb is:
def index
@user = User.find(current_user.id)
@comps = @user.comps
end
and my comps/index file is:
<%= render @comps %>
and my partial comps/_comp file is:
<tr>
<span class="content"><%= comp.name %></span>
<td>
<%= link_to "delete", com开发者_Python百科p, :method => :delete,
:confirm => "You sure?",
:title => comp.name %>
</td>
</tr>
However, I get the error "undefined method `model_name' for NilClass:Class"
I'm not sure what is causing this
精彩评论