Upload file error in rails(urgent)

hi when i tried to runone of my file upload application in
rails i am getting an error lik this. can any one please help
mme?

ActionView::TemplateError (upload_avatar_user_url failed to generate
from {:format=>“js”, :action=>“upload_avatar”, :controller=>“users”,
:id=>nil}, expected: {:action=>“upload_avatar”, :controller=>“users”},
diff: {:format=>“js”, :id=>nil}) on line #2 of
app/views/lists/_import.html.haml:
1: .remote
2: - form_for(@user, :url => upload_avatar_user_path(@user, :format =>
“js”), :html => { :multipart => true, :target => “uploading”, :onsubmit
=> “$('user_submit).disabled = true” }) do |f|
3: = link_to_close avatar_user_path(@user)
4: .section
5: %small

Hi Tony,

Rails is telling you that your “upload_avatar_user_path(@user, :format
=> ‘js’)” method call is not generating a correct route.

A couple things come to mind that could help to resolve the issue:

  1. Make sure that you have defined the resource in your config/
    routes.rb

    map.resources :users, :member => { :upload_avatar => :put }

  2. Make sure that the @user instance variable is not nil.

I’d probably need to see more code to help further.

Lake

Hi Tony,

Rails is telling you that your “upload_avatar_user_path(@user, :format
=> ‘js’)” method call is not generating a correct route.

A couple things come to mind that could help to resolve the issue:

  1. Make sure that you have defined the resource in your config/
    routes.rb

    map.resources :users, :member => { :upload_avatar => :put }

  2. Make sure that the @user instance variable is not nil.

I’d probably need to see more code to help further.

Lake