You get this error because you are calling the method postlist not on one event, but on an array of events. By the way, the general convention in Rails is to call those variables @events
and @posts
(Just a tip, getting used to it can be convenient later).
Can you show us your group class ?
I would write something like that :
def show
@events = @group.events.includes(:posts)
end
The includes method will join the posts table to the SQL query you are performing, loading the posts before rendering the view. Your view then look like :
<%= @events.each do |e| %>
<ul>
<li><%= e.title %></li>
<%= e.posts.each do |p| %>
<ul>
<li><%= p.comment %> | <%=p.user_id%> </li>
</ul>
<%end%>
</ul>
<%end%>
And I believe you can remove the postlist and the eventlist method. Those kind of functions already exist.