Jan Svitok wrote:
> On 3/14/07, Fei Liu <feiliu / aepnetworks.com> wrote:
>> Hi Group, I have a question about eruby. I keep getting the following
>> error. I get the same error in apache error log when I try to view it in
>> firefox. How do I fix it:
>>
>> eruby pique.rhtml
>> pique.rhtml:1: undefined method `form_remote_tag' for main:Object
>> (NoMethodError)
>> --- generated code ---
>> print(( form_remote_tag :url => { :action => 'whet' } )); print "   \n"
>> print "Enter your name: "; print(( text_field_tag :name )); print " \n"
>> print(( submit_tag "Greet Me" )); print " \n"
>> print(( end_form_tag )); print " \n"
>> print "<h2 id=\"greeting\" style=\"display: none\"></h2>\n"
>> ----------------------
>>
>> Installed RPMS (on FC5):
>> eruby-libs-1.0.5-5.2.1
>> ruby-devel-1.8.5.2-1.fc5
>> ruby-irb-1.8.5.2-1.fc5
>> ruby-1.8.5.2-1.fc5
>> ruby-mode-1.8.4-8.fc5
>> ruby-rdoc-1.8.5.2-1.fc5
>> eruby-1.0.5-5.2.1
>> ruby-libs-1.8.5.2-1.fc5
>> rubygems-0.9.2-1.fc5
>>
>> eruby]$ more *
>> ::::::::::::::
>> pique.rhtml
>> ::::::::::::::
>> <%= form_remote_tag :url => { :action => 'whet' } %>
>> Enter your name: <%= text_field_tag :name %>
>> <%= submit_tag "Greet Me" %>
>> <%= end_form_tag %>
>> <h2 id="greeting" style="display: none"></h2>
>> ::::::::::::::
>> whet.rjs
>> ::::::::::::::
>> page[:greeting].hide page[:greeting].update "Greetings, " + params[:name]
>> page[:greeting].visual_effect :grow
>> page.select("form").first.reset
>>
>>
>> more mod_ruby.conf:
>> # ClearModuleList
>> # AddModule mod_ruby.c
>>
>> <IfModule !mod_ruby.c>
>>   LoadModule ruby_module /usr/lib/httpd/modules/mod_ruby.so
>> #  AddType text/html .rhtml
>>   AddType application/x-httpd-cgi .rhtml
>>   RubyRequire apache/eruby-run
>>
>>   # Execute files under /ruby as Ruby scripts
>>   <Location /eruby>
>>   SetHandler ruby-object
>>   RubyHandler Apache::ERubyRun.instance
>>   </Location>
>>
>>   # Execute *.rbx files as Ruby scripts
>>   <Files *.rbx>
>>   SetHandler ruby-object
>>   RubyHandler Apache::ERubyRun.instance
>>   </Files>
>>   <Files *.rhtml>
>>   SetHandler ruby-object
>>   RubyHandler Apache::ERubyRun.instance
>>   </Files>
>> <Directory /home/devel/public_html/eruby>
>>     Options ExecCGI
>> </Directory>
>> </IfModule>
>>
>> gem list:
>> *** LOCAL GEMS ***
>>
>> actionmailer (1.3.3)
>>     Service layer for easy email delivery and testing.
>>
>> actionpack (1.13.3)
>>     Web-flow and rendering framework putting the VC in MVC.
>>
>> actionwebservice (1.2.3)
>>     Web service support for Action Pack.
>>
>> activerecord (1.15.3)
>>     Implements the ActiveRecord pattern for ORM.
>>
>> activesupport (1.4.2)
>>     Support and utility classes used by the Rails framework.
>>
>> cgi_multipart_eof_fix (2.1)
>>     Fix an exploitable bug in CGI multipart parsing which affects Ruby
>>     <= 1.8.5 when multipart boundary attribute contains a non-halting
>>     regular expression string.
>>
>> daemons (1.0.5)
>>     A toolkit to create and control daemons in different ways
>>
>> fastthread (0.6.4.1)
>>     Optimized replacement for thread.rb primitives
>>
>> gem_plugin (0.2.2)
>>     A plugin system based only on rubygems that uses dependencies only
>>
>> mongrel (1.0.1)
>>     A small fast HTTP library and server that runs Rails, Camping, Nitro
>>     and Iowa apps.
>>
>> rails (1.2.3)
>>     Web-application framework with template engine, control-flow layer,
>>     and ORM.
>>
>> rake (0.7.2)
>>     Ruby based make-like utility.
>>
>> sources (0.0.1)
>>     This package provides download sources for remote gem installation
> 
> Hi,
> 
> form_remote_tag is from the ActionPack, To be able to use it you need
> to require it somehow, something like:
> 
> require 'rubygems'
> gem 'actionpack'
> require 'actionview/helpers/prototype_helper'
> 
> (maybe you'll need to prepend lib/ to actionview)
> and probably you'll need to reference prototype.js from your html pages.
> 
Thanks for your reply. I am trying out your suggestions, in my case I 
believe it's lib/actionview/helpers/prototype_helper. But I keep getting 
errors:
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in 
`gem_original_require': no such file to load -- 
lib/action_view/helpers/prototype_helper.rb (LoadError)
         from 
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
--- generated code ---
  require 'rubygems' ; print "\n"
  gem 'actionpack' ; print "\n"
  require 'lib/action_view/helpers/prototype_helper.rb' ; print "\n"
  require 'lib/action_view/helpers/javascripts/prototype.js' ; print "\n"
print(( form_remote_tag :url => { :action => 'whet' } )); print "   \n"
print "Enter your name: "; print(( text_field_tag :name )); print " \n"
print(( submit_tag "Greet Me" )); print " \n"
print(( end_form_tag )); print " \n"
print "<h2 id=\"greeting\" style=\"display: none\"></h2>\n"
----------------------

pique.rhtml:
<% require 'rubygems' %>
<% gem 'actionpack' %>
<% require 'lib/action_view/helpers/prototype_helper.rb' %>
<% require 'lib/action_view/helpers/javascripts/prototype.js' %>
<%= form_remote_tag :url => { :action => 'whet' } %>
Enter your name: <%= text_field_tag :name %>
<%= submit_tag "Greet Me" %>
<%= end_form_tag %>
<h2 id="greeting" style="display: none"></h2>

ls /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/
active_record_helper.rb  date_helper.rb          form_tag_helper.rb 
        pagination_helper.rb     url_helper.rb
asset_tag_helper.rb      debug_helper.rb         javascript_helper.rb 
        prototype_helper.rb
benchmark_helper.rb      deprecated_helper.rb 
java_script_macros_helper.rb  scriptaculous_helper.rb
cache_helper.rb          form_helper.rb          javascripts 
        tag_helper.rb
capture_helper.rb        form_options_helper.rb  number_helper.rb 
        text_helper.rb

I've tried both with '.rb' and without '.rb', neither one works...

Fei