# How to show waiting msg while rails is doing something else

**URL:** <https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164>\
**Category:** Rails\
**Created:** [January 5, 2007, 4:20pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164 "2007-01-05T16:20:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 5, 2007, 4:20pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164/1 "2007-01-05T16:20:58Z")

</div>

Hi,

I have some calculation to do in some part of my ruby-rails application,  
I wish to show a “waiting message” whilw rails is calculating the result  
and when the result is already, I can remove the waiting message and put  
the final result. I have no idea how I can do this. can some one give me  
a clue???

Thanks you very much

Sayoyo

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 5, 2007, 4:44pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164/2 "2007-01-05T16:44:24Z")

</div>

sayoyo wrote:

> Hi,
> 
> I have some calculation to do in some part of my ruby-rails application,  
> I wish to show a “waiting message” whilw rails is calculating the result  
> and when the result is already, I can remove the waiting message and put  
> the final result. I have no idea how I can do this. can some one give me  
> a clue???
> 
> Thanks you very much
> 
> Sayoyo

This action might be a great candidate to use AJAX for… Check out  
this simple tutorial on the subject:

> **[Radar - O’Reilly](https://www.oreilly.com/radar/)**
>
> Now, next, and beyond: Tracking need-to-know trends at the intersection of business and technology

It should help you out.

- Greetz,

Danny

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 5, 2007, 4:56pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164/3 "2007-01-05T16:56:40Z")

</div>

Hi,

Thanks you very much for the info. But, we have already tried, but it  
doesn’t really what we need, since we have to tell the users how many  
percentage the task has been completed, ajax just allow us the change  
the html contain once, but not a interval of time… also, we render to  
a new /controller/action when the calculation happens. so ajax can’t  
hardly apply here,

Thanks you very much for the information

Saiho

Daniel Owen van Dommelen wrote:

> sayoyo wrote:
> 
> > Hi,
> > 
> > I have some calculation to do in some part of my ruby-rails application,  
> > I wish to show a “waiting message” whilw rails is calculating the result  
> > and when the result is already, I can remove the waiting message and put  
> > the final result. I have no idea how I can do this. can some one give me  
> > a clue???
> > 
> > Thanks you very much
> > 
> > Sayoyo
> 
> This action might be a great candidate to use AJAX for… Check out  
> this simple tutorial on the subject:
> 
> [Radar – O’Reilly](http://www.onlamp.com/pub/a/onlamp/2005/06/09/rails_ajax.html)
> 
> It should help you out.
> 
> - Greetz,
> 
> Danny

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 5, 2007, 5:00pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164/4 "2007-01-05T17:00:18Z")

</div>

sayoyo wrote:

> Hi,
> 
> Thanks you very much for the info. But, we have already tried, but it  
> doesn’t really what we need, since we have to tell the users how many  
> percentage the task has been completed, ajax just allow us the change  
> the html contain once, but not a interval of time… also, we render to  
> a new /controller/action when the calculation happens. so ajax can’t  
> hardly apply here,
> 
> Thanks you very much for the information
> 
> Saiho

Ajax does have methods for doing your interval thing. Just check the  
second page of the tutorial it speaks of it a little… Consider this  
little extract from the tutorial:

Live Search:  
\<%= text\_field\_tag :searchtext %\>  
\<%= observe\_field(:searchtext,  
:frequency =\> 0.25,  
:update =\> :search\_hits,  
:url =\> { :action =\> :live\_search }) %\>

Search Results:

Just check the Internet a little for some info. Since I’m currently  
actually learning Rails (have to know enough to work in it by monday) I  
can’t really help you specifically, but Ajax is definately the way to go  
here, I believe anyway…

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 5, 2007, 5:18pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164/5 "2007-01-05T17:18:20Z")

</div>

Hi Daniel,

Once again thanks you for the informatin, however, “the interval” you  
have mentionned works on a specific html component(oberver field), I’m  
really not sure that it will work on a currently running rails processus  
(I may be wrong), what we are trying to do is gathering information from  
user, than compute the information, to activate the computation, we use  
a normal “rails-button” from a form it means, it will send the result on  
a new /controller/action. but between the old /controller/action and the  
new one, there will pass a several seconds, 10 -20 sec. but since the  
“post/get” is already send to server, the browser is waiting… and we  
would like to have some “waiting message”, just want to keep the user  
eye busy…

Thanks you bery much

Saiho

Daniel Owen van Dommelen wrote:

> sayoyo wrote:
> 
> > Hi,
> > 
> > Thanks you very much for the info. But, we have already tried, but it  
> > doesn’t really what we need, since we have to tell the users how many  
> > percentage the task has been completed, ajax just allow us the change  
> > the html contain once, but not a interval of time… also, we render to  
> > a new /controller/action when the calculation happens. so ajax can’t  
> > hardly apply here,
> > 
> > Thanks you very much for the information
> > 
> > Saiho
> 
> Ajax does have methods for doing your interval thing. Just check the  
> second page of the tutorial it speaks of it a little… Consider this  
> little extract from the tutorial:
> 
> Live Search:  
> \<%= text\_field\_tag :searchtext %\>  
> \<%= observe\_field(:searchtext,  
> :frequency =\> 0.25,  
> :update =\> :search\_hits,  
> :url =\> { :action =\> :live\_search }) %\>
> 
> Search Results:
> 
> Just check the Internet a little for some info. Since I’m currently  
> actually learning Rails (have to know enough to work in it by monday) I  
> can’t really help you specifically, but Ajax is definately the way to go  
> here, I believe anyway…

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 5, 2007, 5:41pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164/6 "2007-01-05T17:41:18Z")

</div>

OK,

thanks for the information I will have a close look on it!

> why don’t you try backgroundrb ?
> 
> [http://backgroundrb.rubyforge.org/](http://backgroundrb.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 5, 2007, 5:29pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164/7 "2007-01-05T17:29:49Z")

</div>

sayoyo wrote:

> Hi Daniel,
> 
> Once again thanks you for the informatin, however, “the interval” you  
> have mentionned works on a specific html component(oberver field), I’m  
> really not sure that it will work on a currently running rails processus  
> (I may be wrong), what we are trying to do is gathering information from  
> user, than compute the information, to activate the computation, we use  
> a normal “rails-button” from a form it means, it will send the result on  
> a new /controller/action. but between the old /controller/action and the  
> new one, there will pass a several seconds, 10 -20 sec. but since the  
> “post/get” is already send to server, the browser is waiting… and we  
> would like to have some “waiting message”, just want to keep the user  
> eye busy…
> 
> Thanks you bery much
> 
> Saiho

why don’t you try backgroundrb ?

[http://backgroundrb.rubyforge.org/](http://backgroundrb.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 5, 2007, 5:58pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164/8 "2007-01-05T17:58:14Z")

</div>

there is a rjs tutorial from oreilly for 6 bucks… i highly recommend it  
because it shows how awesome it is to use rjs + ajax.

sayoyo

wrote:

> Hi,
> 
> I have some calculation to do in some part of my ruby-rails application,  
> I wish to show a “waiting message” whilw rails is calculating the result  
> and when the result is already, I can remove the waiting message and put  
> the final result. I have no idea how I can do this. can some one give me  
> a clue???
> 
> Thanks you very much
> 
> Sayoyo

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [January 5, 2007, 11:34pm UTC](https://www.ruby-forum.com/t/how-to-show-waiting-msg-while-rails-is-doing-something-else/81164/9 "2007-01-05T23:34:33Z")

</div>

I think what you are after goes under the title “Progress Bar”.

Maybe search the web for that.

Stephan
