title: class_eval block argument and class_eval string argument differences
body: <p>To simplify my situation, I have a module which is loaded into Mongoid::Document when my Rails app is initialized:</p>
  
  <pre><code>Mongoid::Document.send(:include, ActiveRecordBridge)
  </code></pre>
  
  <p>This module defines a method:</p>
  
  <pre><code>def has_many_records(*records)
    options = records.extract_options!
    if options[:polymorphic]
      class_eval &lt;&lt;-EOS
        def #{ record }
          @#{ record } ||= #{ record.to_s.singularize.classify.constantize }.where( document_id: String(id), document_type: self.class.name)
        end
      EOS
    end
  end
  </code></pre>
  
  <p>Now my Mongoid class makes use of it:</p>
  
  <pre><code>class Something
    include Mongoid::Document
    has_many_records :something_else, polymorphic: true
  end
  </code></pre>
  
  <p>This has worked great, but then another developer added the <a href="https://github.com/chrismccord/sync" rel="nofollow">sync</a> gem into my system, and has made use of it in the SomethingElse class:</p>
  
  <pre><code>class SomethingElse &lt; ActiveRecord::Base
    sync :all
  end
  </code></pre>
  
  <p>As soon as I start up the Rails app, I am hit with the following exception:</p>
  
  <pre><code>Uncaught exception: undefined method `sync' for #&lt;Class:0x007fb7910530c0&gt;
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activerecord-4.1.5/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
      /Users/donato/projects/core revisions/core/app/models/something_else.rb:73:in `&lt;class:Task&gt;'
      /Users/donato/projects/core revisions/core/app/models/something_else.rb:19:in `&lt;top (required)&gt;'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:443:in `load'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:443:in `block in load_file'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:633:in `new_constants_in'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:442:in `load_file'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:342:in `require_or_load'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:480:in `load_missing_constant'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:180:in `const_missing'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:238:in `const_get'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:238:in `block in constantize'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `each'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `inject'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `constantize'
      /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/activesupport-4.1.5/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
      /Users/donato/projects/core revisions/core/lib/active_record_bridge.rb:55:in `block in has_many_records'
  </code></pre>
  
  <p>Here is the interesting part. When I replace the string argument to class_eval with a block, the error goes away:</p>
  
  <pre><code>      class_eval do
            def something_elses
              @something_elses ||= SomethingElse.where(document_id: String(id), document_type: self.class.name)
            end
          end
  </code></pre>
  
  <p>While this works, this is not what I want, because now I am explicitly writing something_else rather than using string interpolation. </p>
  
  <p><strong>My question: What about the string argument that would cause this error, while the block argument does not?</strong></p>