# Periodically\_call\_remote(), WebChat Q

**URL:** <https://www.ruby-forum.com/t/periodically-call-remote-webchat-q/126048>\
**Category:** Rails\
**Created:** [January 15, 2008, 1:11am UTC](https://www.ruby-forum.com/t/periodically-call-remote-webchat-q/126048 "2008-01-15T01:11:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SySySy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/848f3c/32.png) [@SySySy](https://www.ruby-forum.com/u/SySySy)\
**Post date:** [January 15, 2008, 1:11am UTC](https://www.ruby-forum.com/t/periodically-call-remote-webchat-q/126048/1 "2008-01-15T01:11:37Z")

</div>

Hi all,

I am teaching myself rails and I can’t figure out why the following  
code does not work: ‘say’ part works, but nothing shows up for  
‘get\_new’ part.

Here is my chat\_controller.rb file:

class ChatController \< ApplicationController

def index  
end

def say  
@line = params[:say\_so]  
end

def get\_new  
end

end

* * *

Here is my index.rhtml file:

\<%= form\_remote\_tag :update =\> “put\_here”, :url =\> {:action =\> ‘say’}  
%\>  
\<%= text\_field\_tag ‘say\_so’ %\>

\<%= submit\_tag 'Say' %\> \<%= end\_form\_tag %\>

\<%= periodically\_call\_remote :url =\> {:action =\> ‘get\_new’ }, :update  
=\> ‘put\_there’, :frequency =\> 2.0 %\>

* * *

say.rhtml and get\_new.rhtml files are simply:

\<%= @line %\>

---

<div class="post-metadata">

**Author:** ![SySySy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/848f3c/32.png) [@SySySy](https://www.ruby-forum.com/u/SySySy)\
**Post date:** [January 15, 2008, 1:08pm UTC](https://www.ruby-forum.com/t/periodically-call-remote-webchat-q/126048/2 "2008-01-15T13:08:34Z")

</div>

On 15 Jan 2008, at 00:10, Sy wrote:

> Hi all,
> 
> I am teaching myself rails and I can’t figure out why the following  
> code does not work: ‘say’ part works, but nothing shows up for  
> ‘get\_new’ part.

Each request gets a separate instance of ChatController, so setting  
@line to something in the say action has no effect on the value of  
@line when the get\_new action is called.

Fred

> end
> 
> def get\_new  
> end

---

<div class="post-metadata">

**Author:** ![SySySy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/848f3c/32.png) [@SySySy](https://www.ruby-forum.com/u/SySySy)\
**Post date:** [January 15, 2008, 9:53pm UTC](https://www.ruby-forum.com/t/periodically-call-remote-webchat-q/126048/3 "2008-01-15T21:53:27Z")

</div>

Thanks!

On Jan 15, 4:07 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
