Topic: Simple link_to_remote helper to be used within div, tr and other tags

I came across the issue of making set of div tags' OnClick event to be connected with a remote function, yet I couldn't find a helper method to that and I made a simple and stupid helper method by cannibalizing link_to_remote and link_to_function helper methods.

usage: just like using link_to_remote, yet we don't specify "name", since there's no text going inside the tag except the onclick event info

<div <%= onclick_to_remote :url => my_restful_url %> class="my_1">

I works for me and get the work done.. arguments such as :with are supported.. Posting it here hoping someone will find it useful or may be improve it as well.

This code and example is also available as a pastie as well

def onclick_to_remote(options = {})
*args = remote_function(options)
function = args[0] || ''
function = update_page(&block) if block_given?
"onclick=\"#{function}; return false;\""