On 04/12/2011, at 9:51 AM, suranyami wrote:

> 
> On Dec 2, 10:48 pm, Dmytrii Nagirniak <[email protected]> wrote:
> There is a 1.8 fiber library, which I did manage to use and get EM
> working:
> 
>  https://github.com/tmm1/fiber18

Good to know that. Thanks.
> Don't do the view
> rendering (the response), until the callback you register in the first
> part has been called.
> 
> Refactoring your code in arbitrary pseudo-code:
> 
> response = Post.find(123)
> response.callback do |result|
>  render result # using post.title, etc...
> end

I realise that it's better not to do any logic in the view. But that is 
"hidden" logic.
I don't see anything wrong with starting the rendering (or doing anything else) 
in advance. There is really no need to block the whole thread just to wait for 
3 HTTP requests.
(Streaming in Rails 3 is a similar example of this).

Also I am not sure that rendering with callback will work in Rails. You always 
need to render at the end of the request. What the response is if you don't 
render anything?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to