Reputation: 12663
I have a view calling this:
<%= render 'health_safety/access_requests/access_request_user', collection: @access_request_users %>
And in _access_request_user.html.erb
I'm trying to use the collection, e.g.
<%= p access_request_user.inspect %>
And I get the following error:
undefined local variable or method `access_request_user' for #<#<Class:0x007fc8f0160790>:0x007fc8ebf70100>
I'm absolutely stumped, tried heaps of things but nothing's working. If it makes a difference, @access_request_users
is a bunch of User
objects pulled from the database.
Upvotes: 2
Views: 195
Reputation: 2530
Try defining the render as a partial, and if this alone doesn't work try defining the name of the variable:
<%= render partial: 'health_safety/access_requests/access_request_user', collection: @access_request_users, as: :access_request_user %>
Upvotes: 2