Saturday, April 14, 2012

[Rails] Re: undefined method `model_name' for NilClass:Class

new.html.erb

<h1>New Activity</h1>

<%= form_for @activity do |f| %>
<% if @activity.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@activity.errors.count, "error") %>
prohibited this activity from being saved:</h2>

<ul>
<% @activity.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= f.label :activity %><br />
<%= f.text_field :activity %>
</div>
<div class="field">
<%= f.label :responsible %><br />
<%= f.text_field :responsible %>
</div>
<div class="field">
<%= f.label :mail %><br />
<%= f.text_field :mail %>
</div>
<div class="field">
<%= f.label :phone %><br />
<%= f.text_field :phone %>
</div>
<div class="field">
<%= f.label :link %><br />
<%= f.text_field :link %>
</div>
<div class="field">
<%= f.label :forKids %><br />
<%= f.text_field :forKids %>
</div>
<div class="field">
<%= f.label :start_date %><br />
<%= f.text_field :start_date %>
</div>
<div class="field">
<%= f.label :end_date %><br />
<%= f.text_field :end_date %>
</div>
<div class="field">
<%= f.label :iteration %><br />
<%= f.text_field :iteration %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>

NoMethodError in Activities#new

Showing .../app/views/activities/new.html.erb where line #3 raised:
undefined method `model_name' for NilClass:Class


Extracted source (around line #3):
1: <h1>New Activity</h1>
2:
3: <%= form_for @activity do |f| %>
4: <% if @activity.errors.any? %>
5: <div id="error_explanation">
6: <h2><%= pluralize(@activity.errors.count, "error") %>
prohibited this activity from being saved:</h2>

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate