Replace link_to_function with link_to and onclick