hi all:
    when using namespace or nested resources in routes.rb,such as 
"namespace :admin { resources :books }, we can use [:admin,@book] way to 
generate path. It works fine in form_for , but when I use it with 
respond_with in controller, I get problems. 
    The problem is when I put following code in controller:
      
        def create
         @book=Book.find(params[:id])
         @book.save
        respond_with[:admin,@book]
       end 

    if there are some problems and the @book is not saved, the function 
should render new action, hence we can get error messages, but now it 
render index action. and the log file said it got a error 302. if I replace 
'respond_with [ :admin,@book]' with 'respond_with 
@book,:location=>admin_book_path(@book)", it works fine. 
    should we not use "[:admin,@book]" way with respond_with?

thanks

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/13b6ac50-6e21-49bf-8bde-2f38868b7da1%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to