I'm using the default code created by scaffolding. I haven't changed anything.
Showing app/views/presences/_form.html.erb where line #1 raised:
undefined method `model_name' for NilClass:Class
1: <%= form_for(@presence) do |f| %>
2: <% if @presence.errors.any? %>
3: <div id="error_explanation">
4: <h2><%= pluralize(@presence.errors.count, "error") %> prohibited this presence from being saved:</h2>
What is wrong here? I'm never calling a method called "model_name" and this code is automated, so why doesn't it work?
Thanks
Try adding this to your presences_controller
in the new
or other relevant action that is rendering the form:
#presuming your model is called Presence
@presence = Presence.new
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With