[Ror-es] Contador

Sebastian Delmont sd at notso.net
Wed Jun 20 13:59:04 GMT 2007


Otra funcion muy util cuando hace falta escribir codigo javascript a  
la medida que a su vez haga llamadas a rails es "remote_function",  
que genera el codigo javascript necesario para llamar a un  
controlador, similar a la funcion "link_to_remote", pero sin el link.  
"remote_function" es la que genera el contenido del "onclick" en  
"link_to_remote".

Asi que si por ejemplo tienen algo como:

link_to_remote "click", :update => "algun_div", :url => {:controller  
=> "home", :action => "info" }

y por alguna razon necesitan variar ligeramente el comportamiento,  
pueden hacer algo como:

link_to "click", "#", :onclick => "alert('algo diferente'); # 
{remote_function :update => "algun_div", :url => {:controller =>  
"home", :action => "info" }}; alert('algo mas');"




On Jun 20, 2007, at 9:51 AM, Ana wrote:

> Muchísimas gracias,
> con periodically_call_remote funciona perfectamente
> Saludos
> Ana
>
> Damian Janowski wrote:
>> On 6/20/07, Ana <ruby-forum-incoming at andreas-s.net> wrote:
>>> }
>> Para hacer la llamada remota a tu servidor podr�as utilizar
>> Ajax.Request de Prototype [1]
>>
>> Sin embargo, quiz�s tambi�n te pueda ayudar el helper de Rails
>> periodically_call_remote [2], que b�sicamente genera el request  
>> cada X
>> tiempo que le digas.
>>
>> Espero que sirva, saludos!
>>
>> [1] http://prototypejs.org/api/ajax/request
>> [2]
>> http://api.rubyonrails.org/classes/ActionView/Helpers/ 
>> PrototypeHelper.html#M000528
>
>
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ror-es mailing list
> Ror-es at lists.simplelogica.net
> http://lists.simplelogica.net/mailman/listinfo/ror-es



More information about the Ror-es mailing list