Reputation:
I work with faye railscast and have error in view:
<%= render @messages %>
and error:
'nil' is not an ActiveModel-compatible object. It must implement :to_partial_path.
What does this means? <%= @messages %> works, but with render doesnt.
Upvotes: 1
Views: 3575
Reputation: 10684
You are looking for collection rendering, But for that @messages should by array of objects of Message Model.
You can check this
<% unless @messages.blank? %>
<%= render @messages %>
<%end%>
Upvotes: 0
Reputation: 17631
The error message is telling you that @messages
is nil
. When calling
<%= render @messages %>
render
is expecting an ActiveModel-compatible object.
You need to check how @messages
is created in your controller.
Upvotes: 2