Routing Error using Paperclip

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.

Rajinder Y. wrote:

:id=>#<User id: nil, name: “Rajinder”, surname: “Yadav”, email:

<%= f.label :password %>

map.resources :users
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’

I narrowed the error down, it seems that the call to create is failing?

@user = User.create params[:user]
redirect_to user_path @user

so the redirect is producing the error. I have no idea why create is
failing, it was working before I added the Paperclip support.

Rajinder Y. wrote:

user_url failed to generate from {:action=>“show”,
photo_content_type: “image/jpeg”, photo_file_size: 34846>}
<%= f.text_field :email %>

and the entries in routes.rb are

so the redirect is producing the error. I have no idea why create is
failing, it was working before I added the Paperclip support.

I found the reason why I was getting an error, it was a thumbnail
processing error. I recall installing RMagick lastnight and I think I
read somewhere it download installs its own version of ImageMagick? The
Fix was for me to reinstall ImageMagick and now the code is working.

Does RMagick really break functionality fir Paperclip if it’s installed
after? If this is the case I think this should be fixed. I spent a few
hours last night trying to figure out the error. All was not, being new
to Rails I learned how to track down the error, but still burning hours
on something like this is not the best use of anyone’s time!!!

Kind Regards,
Rajinder Y.