Rajinder Yadav wrote:
Rajinder Yadav wrote:
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: "t...@email.com", 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:
"t...@email.com", 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 %><br/>
<%= f.text_field :name %><br/>
<%= f.label :surname %><br/>
<%= f.text_field :surname %><br/>
<%= f.label :email %><br/>
<%= f.text_field :email %><br/>
<%= f.label :password %><br/>
<%= f.password_field :password %><br/>
<p>
<%= f.label 'Picture' %>
<%= f.file_field :photo%>
</p>
<%= 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'
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.
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 Yadav
--
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-t...@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.