Forum: Ruby on Rails how to access ActionView::Helpers::JavaScriptHelper::escape_

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Yi Tan (Guest)
on 2006-05-19 12:47
(Received via mailing list)
Hi all,

Please forgive me for this newbie question. But I really want to know

how to access ActionView::Helpers::JavaScriptHelper::escape_javascript
method in a model.

I can access this method in view, but when call it in the model, it ends
with undefined method.

It seems to me they are in different scope.

So what's the best way to access view helper methods in model.

Many thanks,

Christos Z. (Guest)
on 2006-05-19 13:06
(Received via mailing list)
class MyModel < ActiveRecord::Base
	include	ActionView::Helpers::JavaScriptHelper

	# Rest of your model here ca now use escape_javascript()

This topic is locked and can not be replied to.