I’ve been trying to figure this out for a while now but I can’t see the error.
When I go to jobs/new. Instead of seeing the form that I specified in my view. I’m receiving – undefined method model_name' for NilClass:Class
Here’s my controller where im defining the new action.
class JobsController < ApplicationController
respond_to :html, :json
...
def new
@jobs = Job.new
respond_with @jobs
end
And my view.
<%= form_for(@jobs) do |f| %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :client %><br />
<%= f.text_area :client, rows: 6%>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
And my model.
class Job < ActiveRecord::Base
belongs_to :client
end
The source of the error is line 1 according to the error message in my browser. But I can see where I’m going wrong?
This will work but has no sense 🙂
What do you want to put into your
clienttextarea?