Link_to_remote object missing


Hello, I'm in troubles trying to use 'link_to_remote' on Rails 2.1.
Having this page:

<h4>Editing project</h4>
<% form_for(:project, :url => project_path(@project), :html =>
{ :method => :put }) do |f| %>
    <p>
        Name <%= f.text_field :name %>
        Date <%= calendar_date_select :project, :target_date, :time =>
false %>
        <%= image_submit_tag('accept.png', :alt => "Update", :class =>
'icon') %>
        <%= link_to_remote image_tag('cross.png', :alt =>
'Cancel'), :url => cancel_edit_project_path, :method => :get %>
    </p>
<% end %>
<% form_remote_for(:project, :url =>
add_contributor_project_path(@project), :html => { :method => :put })
do |f| %>
<h4>Contributors</h4> Add contributor <%= text_field_tag 'contributor'
%> <%= image_submit_tag('add.png', :class => 'icon') %>
<% end %>
<%= render :partial => 'contributors', :object => @project %>

And the contributors partial:

<ul id="contributors">
  <% for contributor in @project.contributors %>
      <li id="contributor.<%= contributor.id %>">
          <% link_to_remote image_tag('delete.png', :size =>
'16x16', :alt => 'Destroy'),

delete_contributor_project_path(@project),
                             :method => :put, :contributor_id =>
contributor.id %>
          <%= contributor.user.name %>
      </li>
  <% end %>
</ul>

I get this error:

ActionView::TemplateError (You have a nil object when you didn't
expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]) on line #4 of projects/
_contributors.html.erb:
1: <ul id="contributors">
2:   <% for contributor in @project.contributors %>
3:       <li id="contributor.<%= contributor.id %>">
4:           <% link_to_remote image_tag('delete.png', :size =>
'16x16', :alt => 'Destroy'),
5:
delete_contributor_project_path(params[:project_id]),
6:                              :method => :put, :contributor_id =>
contributor.id %>
7:           <%= contributor.user.name %>

    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/url_rewriter.rb:102:in `rewrite_url'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/url_rewriter.rb:88:in `rewrite'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/base.rb:621:in `url_for'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
helpers/url_helper.rb:76:in `send'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
helpers/url_helper.rb:76:in `url_for'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
helpers/prototype_helper.rb:461:in `remote_function'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
helpers/prototype_helper.rb:255:in `link_to_remote'
    app/views/projects/_contributors.html.erb:4:in
`_run_erb_47app47views47projects47_contributors46html46erb'

changing link_to_remote by link_to the partial renders fine, but
that's not what I want. What's the problem using link_to_remote in
this context?, Which is the missing object?, if @project was nil the
error would be at line 2, but it isn't.
--~--~---------~--~----~------------~-------~--~----~
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@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane