For some reason I can’t figure out why I am getting a routing error when
I add Paperclip support. I have another test app when similar code is
working.
I created a new test app first without Paperclip support and it was
doing the CRUD operation fine. However when I added Paperclip support I
get the following error?
Routing Error
user_url failed to generate from {:action=>“show”, :controller=>“users”,
:id=>#<User id: nil, name: “Rajinder”, surname: “Yadav”, email:
“[email protected]”, password: “hello”, membership_level: 0, location: nil,
timezone: nil, bday: nil, last_visit: nil, visits: nil, created_at: nil,
updated_at: nil, photo_file_name: “devmentor.jpg”, photo_content_type:
“image/jpeg”, photo_file_size: 34846>}, expected: {:action=>“show”,
:controller=>“users”}, diff: {:id=>#<User id: nil, name: “Rajinder”,
surname: “Yadav”, email: “[email protected]”, password: “password”,
membership_level: 0, location: nil, timezone: nil, bday: nil,
last_visit: nil, visits: nil, created_at: nil, updated_at: nil,
photo_file_name: “devmentor.jpg”, photo_content_type: “image/jpeg”,
photo_file_size: 34846>}
The form I am using to submit looks like this
<% form_for @user, :html => { :multipart => true } do |f| %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :surname %>
<%= f.text_field :surname %>
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.label :password %>
<%= f.password_field :password %>
<%= f.label 'Picture' %> <%= f.file_field :photo%>
<%= submit_tag 'Create Account' %> <% end %>and the entries in routes.rb are
map.resources :users
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
–
Kind Regards,
Rajinder Y.