From Kerry:

>I don't
>think you can have 2 renders from an action so that might be why you are
>not seeing the page.

True enough, tried that, but Rails complains. If you put a redirect 
or render  inside a conditional, you're supposed to put a return 
after it. This code is currently commented out in the upload routine:

     unless video.save then
       render :text => html_stop_upload()
       return
   end

At 02:19 PM 8/4/2009, you wrote:
>I think the problem is in the upload action, can you paste the enter code?
>Also, why do you use return after the redirection? That seems like 
>there is something wrong going on.
>
>- Matt

The return was just a way to avoid executing the rest of the 
(too-)lengthy code in the controller. If I comment out that code with 
=begin and =end and make the redirect the last line, the result is the same.

So I've actually posted the entire controller code. It's down to nothing:

class My::OtherController < ApplicationController
   before_filter :login_required

   def upload
     RAILS_DEFAULT_LOGGER.info(">>>>>>>>> My::OtherController::upload")

     RAILS_DEFAULT_LOGGER.info(">>>>>>>>>   redirect_to :action => 
'list', :controller => '/my/video'")
     redirect_to :controller => '/my/video', :action => :list

     =begin
     ... a large amount of code here
     =end
   end
end

class My::VideoController < ApplicationController
   before_filter :login_required

   def list
     RAILS_DEFAULT_LOGGER.info(">>>>>>>>> My::VideoController list")
     # get user and then iterate through @user.compositions in view
     =begin
       ... some code here
     =end
   end
end

Javascript is turned off and the view for list is a trivial line of 
text. I even removed the 'list' method from the controller altogether 
and commented out the LOGGER and before_filter lines. Same result. So 
the problem can't be in this code. And it seems so odd that the 
browser receives something (Firefox says 'Waiting for localhost...' 
and then 'Done') but doesn't display anything new. What did it 
receive if not the view Rails says it rendered?

from the log:
   Parameters: {"action"=>"list", "controller"=>"my/video"}
   User Columns (0.001445)   SHOW FIELDS FROM `users`
   User Load (0.000310)   SELECT * FROM `users` WHERE (`users`.`id` = 
64) LIMIT 1
Rendering template within layouts/application
Rendering my/video/list

Thanks,

Scott


--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to