I've got a problem to get my partial working.

I want to pass an object via a local variable to a partial, but I get a 

```
undefined method `model_name' for NilClass:Class 

```

error all the time. But the variable is passed over because I can call it in the partial with .to\_yaml, which gives me all the variables properties.

But when I try to use it in a form\_for I get that error.

Maybe it has something to do with my db query. Because when i try to call it with another local variable there is no error. But my query should produce a single object, or am I wrong with that?

Here is my show.html.erb:

```
<%= @partneroffer = Partneroffer.where(:partner_id => @partner.id, :yearname_id => year.id).first  %>
<%= render :partial => "form2", :locals => { :partneroffer => @partneroffer } %>

```

And here is my partial (\_form2.html.erb):

```
<%= form_for partneroffer , :html => { :class => 'form-horizontal' } do |f| %>
  <%= f.label :partnerstatus_id, :class => 'control-label' %>
  <%= f.collection_select(:partnerstatus_id, Partnerstatus.all, :id, :name) %>
  <%= f.submit nil, :class => 'btn btn-primary' %>
  <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
 partner_year_terms_path, :class => 'btn' %>
<% end %>

```