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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community 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

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
up
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,

Yi
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()
end

-christos
This topic is locked and can not be replied to.