Well yes, but that method might not like it (eg trying to evaluate the
square root of "cucumber"). I think we need to see exactly what code
you're running. You could have edited out the problem and it's
difficult to work out what's wrong if what we're looking at isn't what
is actually being executed.
Ok, there is the full code:
module OrganizationEventsHelper
def text_field_with_errors( f, method, display_name, size = 30,
options = {} )
self.label( method, (display_name + ':') ) <<
self.text_field( method,
:class => 'input-field',
:size => size ) <<
error_message_on( self, method )
end
end
<% form_for @organization, :url => organization_events_path do |f| %>
<fieldset>
<legend>Church Info</legend>
<ol>
<li><%= text_field_with_errors( f, :church_name, "Church Name") %></
</ol>
</fieldset>
<fieldset class="submit">
<%= f.submit "Create" %>
</fieldset>
<% end %>
Note: I omitted the repetitious code.
Error message:
ActionView::TemplateError (`@#<ActionView::Base:0x256474c>' is not
allowed as an instance variable name) on line #33 of
organization_events/new.html.erb:
30: :size => 30 %>
31: <%= error_message_on :organization, :church_name %></li>
32:
33: <li><%= text_field_with_errors( f, :church_name, "Church
Name") %></li>
34:
35: <li><%= f.label :address1, "Address:" %>
36: <%= f.text_field :address1,
config/initializers/field_error_patch.rb:29:in
`instance_variable_get'
config/initializers/field_error_patch.rb:29:in `error_message_on'
app/helpers/organization_events_helper.rb:9:in
`text_field_with_errors'
app/views/organization_events/new.html.erb:33:in
`_run_erb_47app47views47organization_events47new46html46erb'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/
helpers/form_helper.rb:248:in `fields_for'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/
helpers/form_helper.rb:184:in `form_for'
app/views/organization_events/new.html.erb:22:in
`_run_erb_47app47views47organization_events47new46html46erb'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/
base.rb:637:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/
base.rb:637:in `compile_and_render_template'
<snip>
Let me know if think the whole stack trace would help.
Thanks for the help, Fred.