Yi Tan
2006-May-19 08:45 UTC
[Rails] how to access ActionView::Helpers::JavaScriptHelper::escape_javascript in a model (a newbie question)
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060519/64ce6d68/attachment.html
Christos Zisopoulos
2006-May-19 09:03 UTC
[Rails] how to access ActionView::Helpers::JavaScriptHelper::escape_javascript in a model (a newbie question)
class MyModel < ActiveRecord::Base include ActionView::Helpers::JavaScriptHelper # Rest of your model here ca now use escape_javascript() end -christos On 19 May 2006, at 09:45, Yi Tan wrote:> ActionView::Helpers::JavaScriptHelper