Hi,
I want to create a plugin that allows easy use of the Yahoo! UI
library similar to the prototype.js and scriptaculous helpers that
come packaged with rails.
just one line in plugins/yui/init.rb
require ''yui_helper''
a little more in plugins/yui/lib/yui_helper.rb
module ActionView
module Helpers
module YuiHelper
def yui_form_remote_tag(options = {})
options[:html] ||= {}
options[:html][:action] = options[:html][:action] ||
url_for(options[:url])
options[:html][:onsubmit]
"Yui.post_form(''#{options[:html][:action]}'',this);return
false;"
options[:html][:method] = options[:html][:method] ||
''post''
tag(''form'', options[:html], true)
end
end
end
end
When I use
<%= yui_form_remote_tag(:url=>{:action=>''update'',
:id=>@category}) %>
in a view I see
undefined method `yui_form_remote_tag'' for
#<#<Class:0x2546c20>:0x2546bf8>
I know the method works when it is in my application_helper.rb file
but what do I have to say in yui_helper.rb to make the method visible
from within the plugin?
Thanks,
Peter