– Processing by Admin::PhotographersController#update as HTML
Here is the full action outputhttp://pastie.org/1187051
Can anyone help me, please ?
Don’t know where to start
At a guess it’s because the url being posted to is /admin/photographer.
1 which may be making part of rails think that the requested format
is .1 (as opposed .html, .xml etc), so when you get to your respond_to
block rails can’t generate a response and so generates a 406 instead
(which is http for “I can’t generate the kind of response you asked
for”)
then it goes to Admin::PhotographersController#update :
def update @photographer = current_photographer
if params[:id]
# trying to update a specific photographer on a singular
resource is a no-no
flash[:notice] = “You can only update your own settings!”
redirect_to edit_resource_path
else
update!{ edit_resource_path }
end
end
I agree with Fred. What does your ‘Accept’ header in your browser say
for the request that throws the 406? eg. Accept:text/css Also, check the
content-type in the response headers. You could grab this information
using the developer console in safari or chrome, or firebug in firefox.
I saw something very similar which affect Firefox, but not Safari or
Chrome.
In case of Rails 2.3.8 I get - Processing
Admin::PhotographersController#update (for 127.0.0.1 at 2010-09-29
19:19:38) [PUT] - instead of POST and than redirect back to http://localhost:3000/admin/photographer/edit
namespace :admin do
# session / login / logout
resource :photographer_session
match ‘/login’ => ‘photographer_sessions#new’, :as => :login
match ‘/logout’ => ‘photographer_sessions#destroy’, :as
=> :logout
resource :photographer
resources :photographer_password_resets
…
everything seems ok with the new sintax …, well I think so, anyway
here what “rake routes” show up for admin photographer in both Rails
2.3.8 http://pastie.org/1191253 and Rails 3.0.0 http://pastie.org/1191246
end
Should resource path be something else like admin_photographer_path ?
I’m just guessing, but I’d also look at removing the :photographer and
:method => :put from the form_for line. I think it’s import to sort out
why your URL is generating incorrectly before we troubleshoot the
content type issue. For example, it might be thinking that .1 is a
suffix just like .html or .css and is setting the resource type based on
that.
Also regarding checking the headers. I’ll assume you’re using or can use
chrome. Look under the View menu -> Developer -> Developer tools. Click
on the first item under resources (which should say 406) and click on
the headers tab. Here you can find the accept and content type headers.
the old 2.3.8 used to work like that with same routing logic …
Even if this make me able to going on, I’d really would like to figure
out what makes me .1 tail
Until now, I’ve no idea about why my URL is generating
incorrectly …
Many thanks to Luke and Frederick
for your precious suggestions
Luca G.Soave
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.