Ruby on Rails Thursday, September 30, 2010

Good point Luke, thank you.

I changed to admin_photographer_path as you suggested and it can pass
the redirection. Anyway something strange is still going on here:

1) it redirect to http://localhost:3000/admin/photographer/edit.1

there's still that .1 which smell of .:format mismatching ...

2) I've tons of that form_for(:name, @name, :url =>
resource_path, :html => { :multipart => true, :method => :put }) do |
f|

which are working just fine:

lsoave@ubuntu:~/rails/altrove/lauranovara$ find . -exec grep ":url =>
resource_path, :html => { :multipart => true, :method => :put })" {}
\; -print|grep ^./
./app/views/admin/photos/edit.html.haml
./app/views/admin/photographers/edit.html.haml
./app/views/admin/galleries/edit.html.haml
./app/views/admin/bookings/edit.html.haml
./app/views/admin/quotes/edit.html.haml
./app/views/admin/products/edit.html.haml
./app/views/admin/pages/edit.html.haml
./app/views/admin/gallery_photos/edit.html.haml
./log/development.log
lsoave@ubuntu:~/rails/altrove/lauranovara$

3) 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


On Sep 30, 7:42 pm, Luke Cowell <lcow...@gmail.com> wrote:
> Given the following:
>
> > = form_for(:photographer, @photographer, :url => resource_path, :html
> > => { :multipart => true, :method => :put }) do |f|
> > ...
>
> and
>
> > Rails 3.0.0 :
>
> >  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
> >   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.
>
> Luke

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment