Periodically_call_remote(), WebChat Q

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

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

Thanks!

On Jan 15, 4:07 am, Frederick C. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs