UPDATE:  Stranger and stranger.  I do NOT get this error running in the 
console.  I do NOT get this error running the test suite.  I ONLY get 
this error under 'rails server'.  I tracked the Rails source to where 
the AssociationTypeMismatch is raised in association_proxy.rb:

        def raise_on_type_mismatch(record)
          unless record.is_a?(@reflection.klass) || 
record.is_a?(@reflection.class_name.constantize)
            message = 
"#{@reflection.class_name}(##{@reflection.klass.object_id}) expected, 
got #{record.class}(##{record.class.object_id})"
            raise ActiveRecord::AssociationTypeMismatch, message
          end
        end

and inserted a Rails.logger.debug() statement.

When I'm running in the test suite, I see:

   >>> class=NOAA, record.is_a?(WeatherStation) => true, 
record.is_a?(WeatherStation) => true

When I'm running in under the server, the same run prints:

  >>> class=NOAA, record.is_a?(WeatherStation) => false, 
record.is_a?(WeatherStation) => false

Is there ANYTHING about the server environment (in development mode) 
that would account for is_a? behaving differently???

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to