I’m learning RoR and working on a simple app to share posts. My trouble is creating the posts and displaying them on a separate page(not sure where my error is). When a “user” goes to post an “event” I get an undefined method:
undefined method `model_name’ for NilClass:Class
12: <%= render @events %>
I thought I had defined the method properly, but I guess not.
Thanks in advance for any help you can give.
I’m guessing that this is the controller in question:
You set
@eventin there but not@events. Instance variables are created on first use and default tonilso in your view, when you say this:you’re creating
@eventsright there and it will benil. Perhaps you want: