NoMethodError in 1.2RC

I have a model User that belongs_to EmailAddress (I know that seems
backwards, but that’s the way it really is). In one of the views, I’m
calling @user.email_address.verified?, where the verified? method is
indeed defined in the EmailAddress class. I’ve been working on a
checkout of Edge Rails (rev. 5379), where this works, as it does in
1.1.6. When running 1.2RC, it gives a NoMethodError on verified? only
AFTER the first time. So, it works once, but if you refresh the page,
it dies. When I log the methods on the instance, the first time
around, I get:

==, ===, =~, [], []=, id, send, `, after_create,
after_destroy, after_save, after_update, after_validation,
after_validation_on_create, after_validation_on_update,
allow_concurrency, allow_concurrency=, attribute_names,
attribute_present?, attributes, attributes=,
attributes_before_type_cast, attributes_from_column_definition,
attributes_from_column_definition_with_lock, b64encode, before_create,
before_destroy, before_save, before_update, before_validation,
before_validation_on_create, before_validation_on_update, blank?,
build_registration_invitation, build_user, class,
clear_aggregation_cache, clear_association_cache, clone,
colorize_logging, colorize_logging=, column_for_attribute,
configurations, configurations=, connection,
copy_instance_variables_from, create, create_or_update,
create_or_update_with_callbacks, create_registration_invitation,
create_user, create_with_callbacks, create_with_timestamps,
create_without_timestamps, daemonize, dclone, decode64, decode_b,
decrement, decrement!, default_timezone, default_timezone=, destroy,
destroy_with_callbacks, destroy_with_transactions,
destroy_without_callbacks, destroy_without_transactions, display, dup,
enable_warnings, encode64, eql?, equal?, errors, extend,
extend_with_included_modules_from, extended_by, freeze, frozen?,
generate_key, generate_read_methods, generate_read_methods=,
has_attribute?, has_registration_invitation?,
has_registration_invitation_with_deprecation?,
has_registration_invitation_without_deprecation?, has_user?,
has_user_with_deprecation?, has_user_without_deprecation?, hash, id,
id=, id_before_type_cast, increment, increment!, initialize,
initialize_with_callbacks, inspect, instance_eval, instance_exec,
instance_of?, instance_values, instance_variable_get,
instance_variable_set, instance_variables, is_a?, kind_of?, load,
lock!, lock_optimistically, lock_optimistically=, locking_enabled?,
logger, logger=, method, methods, new_record?, nil?, object_id,
pluralize_table_names, pluralize_table_names=,
primary_key_prefix_type, primary_key_prefix_type=, private_methods,
protected_methods, public_methods, quote, quote_with_deprecation,
quoted_id, readonly!, readonly?, record_timestamps,
record_timestamps=, registration_invitation, registration_invitation=,
registration_invitation?, registration_invitation_with_deprecation?,
registration_invitation_without_deprecation?, reload,
remove_subclasses_of, require, require_gem, require_gem_with_options,
require_library_or_gem, respond_to?, respond_to_without_attributes?,
returning, save, save!, save_with_transactions,
save_with_transactions!, save_with_validation, save_with_validation!,
save_without_transactions, save_without_transactions!,
save_without_validation, save_without_validation!, schema_format,
schema_format=, send, set_registration_invitation_target,
set_user_target, silence_stderr, silence_stream, silence_warnings,
singleton_methods, subclasses_of, suppress, table_name_prefix,
table_name_prefix=, table_name_suffix, table_name_suffix=, taguri,
taguri=, taint, tainted?, to_a, to_json, to_param, to_s, to_xml,
to_yaml, to_yaml_properties, to_yaml_style, toggle, toggle!,
transaction, type, unloadable, untaint, update, update_attribute,
update_attribute_with_validation_skipping,
update_attribute_without_validation_skipping, update_attributes,
update_attributes!, update_with_callbacks, update_with_lock,
update_with_timestamps, update_without_callbacks,
update_without_timestamps, user, user=, user?, user_with_deprecation?,
user_without_deprecation?, valid?, valid_with_callbacks?,
valid_without_callbacks?, validate, validate_on_create,
validate_on_update, verification_timeout, verification_timeout=,
verified?, verify_key, verify_key!, with_options

You can clearly see the verified method there. The very next time
through, I get:

==, ===, =~, [], []=, id, send, `, after_create,
after_destroy, after_save, after_update, after_validation,
after_validation_on_create, after_validation_on_update,
allow_concurrency, allow_concurrency=, attribute_names,
attribute_present?, attributes, attributes=,
attributes_before_type_cast, attributes_from_column_definition,
attributes_from_column_definition_with_lock, b64encode, before_create,
before_destroy, before_save, before_update, before_validation,
before_validation_on_create, before_validation_on_update, blank?,
class, clear_aggregation_cache, clear_association_cache, clone,
colorize_logging, colorize_logging=, column_for_attribute,
configurations, configurations=, connection,
copy_instance_variables_from, create, create_or_update,
create_or_update_with_callbacks, create_with_callbacks,
create_with_timestamps, create_without_timestamps, daemonize, dclone,
decode64, decode_b, decrement, decrement!, default_timezone,
default_timezone=, destroy, destroy_with_callbacks,
destroy_with_transactions, destroy_without_callbacks,
destroy_without_transactions, display, dup, enable_warnings, encode64,
eql?, equal?, errors, extend, extend_with_included_modules_from,
extended_by, freeze, frozen?, generate_read_methods,
generate_read_methods=, has_attribute?, hash, id, id=,
id_before_type_cast, increment, increment!, initialize,
initialize_with_callbacks, inspect, instance_eval, instance_exec,
instance_of?, instance_values, instance_variable_get,
instance_variable_set, instance_variables, is_a?, kind_of?, load,
lock!, lock_optimistically, lock_optimistically=, locking_enabled?,
logger, logger=, method, methods, new_record?, nil?, object_id,
pluralize_table_names, pluralize_table_names=,
primary_key_prefix_type, primary_key_prefix_type=, private_methods,
protected_methods, public_methods, quote, quote_with_deprecation,
quoted_id, readonly!, readonly?, record_timestamps,
record_timestamps=, reload, remove_subclasses_of, require,
require_gem, require_gem_with_options, require_library_or_gem,
respond_to?, respond_to_without_attributes?, returning, save, save!,
save_with_transactions, save_with_transactions!, save_with_validation,
save_with_validation!, save_without_transactions,
save_without_transactions!, save_without_validation,
save_without_validation!, schema_format, schema_format=, send,
silence_stderr, silence_stream, silence_warnings, singleton_methods,
subclasses_of, suppress, table_name_prefix, table_name_prefix=,
table_name_suffix, table_name_suffix=, taguri, taguri=, taint,
tainted?, to_a, to_json, to_param, to_xml, to_yaml,
to_yaml_properties, to_yaml_style, toggle, toggle!, transaction, type,
unloadable, untaint, update, update_attribute,
update_attribute_with_validation_skipping,
update_attribute_without_validation_skipping, update_attributes,
update_attributes!, update_with_callbacks, update_with_lock,
update_with_timestamps, update_without_callbacks,
update_without_timestamps, valid?, valid_with_callbacks?,
valid_without_callbacks?, validate, validate_on_create,
validate_on_update, verification_timeout, verification_timeout=,
with_options

I don’t know why, but there it is. Has anyone else seen this?

–Scott

I am going nuts with this same issue. I just upgraded to 1.2 RC1 as
well.

It works once after restarting Mongrel, but the next request it’s my
objects lose their instance methods. I’ve just begun trying to debug.
Anyone know the fix?

Ok, I’ve spent all night trying to figure this out but no luck. I don’t
even really fully understand what is wrong. My app is broken completely
now because of this. Anyone else having this problem where public
instance methods seem to disappear from your object’s scope?

Here is my development.log:

ActionView::TemplateError (undefined method `containers’ for
#HomePage:0xb724649c) on line #1 of
app/views/shared/page_of_wamlets.rhtml:
1: <%= render :partial => ‘container/container’, :collection =>
@page.containers %>
2: <%= javascript_tag "Droppables.add(“canvas”, {
3: onDrop: function(element){#{remote_function(:url =>
{:controller => ‘container’, :action => ‘move’},
4: :with => “‘id=’ + getContainerId(element.id) +’&xpos=’+
parseInt(Element.getStyle(element,‘left’) || ‘0’) + ‘&ypos=’ +
parseInt(Element.getStyle(element,‘top’) || ‘0’)”,

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5618/lib/active_record/associations/association_proxy.rb:123:in
`send’

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5618/lib/active_record/associations/association_proxy.rb:123:in
method_missing' #{RAILS_ROOT}/app/views/shared/page_of_wamlets.rhtml:1:in_run_rhtml_47app47views47shared47page_of_wamlets46rhtml’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_view/base.rb:326:in
`send’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_view/base.rb:326:in
`compile_and_render_template’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_view/base.rb:301:in
`render_template’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_view/base.rb:260:in
`render_file’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/base.rb:786:in
`render_file’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/base.rb:724:in
`render_with_no_layout’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/layout.rb:244:in
`render_without_benchmark’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/benchmarking.rb:50:in
render' /usr/local/lib/ruby/1.8/benchmark.rb:293:inmeasure’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/benchmarking.rb:50:in
render' #{RAILS_ROOT}/app/controllers/home_controller.rb:19:inindex’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/base.rb:1068:in
`send’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/base.rb:1068:in
`perform_action_without_filters’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:635:in
`call_filter’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:641:in
`call_filter’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:438:in
`call’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:640:in
`call_filter’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:641:in
`call_filter’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:438:in
`call’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:640:in
`call_filter’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:641:in
`call_filter’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:438:in
`call’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:640:in
`call_filter’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:622:in
`perform_action_without_benchmark’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/benchmarking.rb:66:in
perform_action_without_rescue' /usr/local/lib/ruby/1.8/benchmark.rb:293:inmeasure’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/benchmarking.rb:66:in
`perform_action_without_rescue’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/rescue.rb:81:in
`perform_action’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/base.rb:427:in
`send’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/base.rb:427:in
`process_without_filters’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/filters.rb:627:in
`process_without_session_management_support’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/session_management.rb:114:in
`process’

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5.5618/lib/action_controller/base.rb:330:in
`process’

/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6.5618/lib/dispatcher.rb:41:in
`dispatch’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:84:in
process' /usr/local/lib/ruby/1.8/sync.rb:229:insynchronize’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:83:in
`process’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:580:in
`process_client’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:in
`each’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:in
`process_client’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
`run’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
`initialize’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
`new’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
`run’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in
`initialize’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in
`new’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in
`run’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:267:in
`run’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:266:in
`each’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:266:in
`run’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:127:in
`run’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/command.rb:211:in
`run’

/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:231
/usr/local/bin/mongrel_rails:18:in `load’
/usr/local/bin/mongrel_rails:18

And the mongrel server output:

Tue Nov 28 03:46:59 -0500 2006: Error calling Dispatcher.dispatch
#<NameError: cannot remove Object::LOCALIZED_STRINGS>
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5618/lib/active_support/dependencies.rb:416:in
remove_const' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5618/lib/active_support/dependencies.rb:416:insend’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5618/lib/active_support/dependencies.rb:416:in
remove_constant' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5618/lib/active_support/dependencies.rb:270:inremove_unloadable_constants!’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5618/lib/active_support/dependencies.rb:270:in
each' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5618/lib/active_support/dependencies.rb:270:inremove_unloadable_constants!’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1.5618/lib/active_support/dependencies.rb:73:in
clear' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6.5618/lib/dispatcher.rb:63:inreset_application!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6.5618/lib/dispatcher.rb:115:in
reset_after_dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6.5618/lib/dispatcher.rb:51:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:84:in
process' /usr/local/lib/ruby/1.8/sync.rb:229:insynchronize’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:83:in
process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:580:inprocess_client’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:in
each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:inprocess_client’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:ininitialize’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in
initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:innew’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:267:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:266:in
each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:266:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:127:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/command.rb:211:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:231
/usr/local/bin/mongrel_rails:18:in `load’
/usr/local/bin/mongrel_rails:18

Well, I hope this gets figured out soon. I rolled back to Rails 1.1.6
and everything is working fine again. I added some detail to the ticket
from my environment to provide more information.

http://dev.rubyonrails.org/ticket/6720

OK, since a few others are seeing the same thing and I haven’t seen any
ideas, I’ve posted a ticket (#6720) to dev.rubyonrails.org.

–Scott