Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Rafael Lima http://rafael.adm.br

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Javascript Link Helper

Ruby on Rails helper to create a link tag to 'name' wich execute the 'javascript' statement onclick event. The last both parameters are the same as for link_to.

Helper para o Ruby on Rails para criar um tag de link associado ao 'name' que executa o código 'javascript' no evento onclick. Os últimos dois parâmetros são os mesmos utilizados no link_to

	def javascript_link_to(name, javascript, html_options = nil, *parameters_for_method_reference)
		options = [ :action => @params["action"] ]
		html_options = { :onclick => javascript+"return false" }
		link_to(name, options, html_options, *parameters_for_method_reference)
	end
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS