rubyonrailsin

A Ruby and Rails talk

Thursday, March 25, 2010


Re: [Rails] Re: Re: redirection in format.json ...

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Again: Make sure that format.json is in fact called. Maybe try removing format.html to make sure that the redirect isn't done there.

/Lasse

2010/3/25 Kad Kerforn <lists@ruby-forum.com>
Lasse Bunk wrote:
> Maybe you're not requesting it properly, making sure that you call the
> format.json part? It seems it redirects to requests_url in format.html.
>
> /Lasse
>
> 2010/3/23 Kad Kerforn <lists@ruby-forum.com>

yes... after some tests, I rewrote the original format.json line  (from
the plugin uploadify_rails) as :

       format.json { render :json => { :result => 'success', :request
=> member_request_url(@request[:id]) } }

this redirects to  :show  (don't misunderstand it , 'request' is my
model instance...)
and I just modified the :show action as following :

   respond_to do |format|
..
     format.js {
       render :update do |page|
         page.redirect_to member_requests_url
       end
     }
   end

this time, the redirection is fine....  which is enough for my test,
I'll try to investigate a little bit more to understand why:

       format.json { render :json => { :result => 'success', :request
=> member_request_url(@request[:id]) } }

redirects to :show with a format .js

I thought I could write a :callback => 'index', no change... it's always
redirected to :show...
OR is it an issue in using  :request =>
maybe this is a parameter used by the render.json ...

thanks a lot for your help

--
Posted via http://www.ruby-forum.com/.

--
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.


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

Subscribe feeds via e-mail

Blog Archive