Re: Running activerecord

On Fri, 18 Apr 2008 15:56:32 -0700, “John L. (IRONRUBY)”
[email protected] said:

Thanks for doing this work, Brian! This will give me a bunch of things to
look at around the core libs this weekend.

Thanks John! I have encountered some further issues trying to run
activerecord which I will detail in a moment, but firstly I’ve worked
out what is going on with issue (9) in my previous email:

(9) Problem with
activesupport-2.0.2\lib\active_support\core_ext\array\conversions.rb

  • unknown: Cannot cast from ‘Microsoft.Scripting.SymbolId’ to
    ‘Ruby.Builtins.Proc’
    (ArgumentError)

  • This is the offending piece of code in conversions.rb:

    def to_param
      map(&:to_param).join '/'
    end
    

The & operator should call to_proc on the object, but IronRuby is
currently not doing so - I have filed a bug report on RubyForge.
Symbol.to_proc is defined in activesupport in order to support the above
piece of syntactic sugar. “&:some_symbol” is simply shorthand for
“Proc.new { |a| a.some_symbol }”, so as a temporary workaround, any such
occurrences in activesupport can be replaced with the latter expression.

Here are some new issues that I have encountered with
activesupport/activerecord:

(1) Missing library stringio

  • As a workaround, I copied the pure Ruby implementation from YAML
    (this should be in C:\ruby\lib\ruby\1.8\yaml\stringio.rb in the MRI
    distribution).

(2) Problem with active_support/core_ext/logger.rb
:0:in define_around_helper': wrong number or type of arguments formodule_eval’ (ArgumentError)

  • There is currently no implementation of module_eval that accepts a
    string parameter. As a workaround, I rewrote logger.rb so that it
    passes a block to module_eval (see attached logger.rb). John has
    mentioned that the eval methods should be coming soon, which would
    be very helpful indeed…

(3) Problem with active_support/core_ext/module/attr_internal
:0:in main': undefined local variable or methodattr_internal_naming_format=’
for Module:Class (NoMethodError)

  • The same problem as (2): activesupport defines a method
    mattr_accessor which calls module_eval with a string parameter. As a
    workaround, I manually defined the accessor
    attr_internal_naming_format in attr_internal.rb (see attachment)

(4) Missing method Regexp.quote

  • active_support\core_ext\pathname.rb requires the Ruby library
    pathname, which in turn calls Regexp.quote.
  • Workaround: commented out “require ‘pathname’”

(5) Problem with active_support/core_ext/string/iterators.rb

  • Logical operators in method arguments won’t parse - the following
    line is the culprit:
    loop { yield(scanner.scan(char) || break) }

  • I have filed a bug report in RubyForge. Wayne K. has confirmed
    that this is a parser bug (incorrect grammar) - see
    http://rubyforge.org/tracker/index.php?func=detail&aid=19672&group_id=4359&atid=16798

  • As a workaround, I rewrote the above line as:

      loop do
        s = scanner.scan(char)
        if !s
          break
        end
        yield(s)
      end
    
  • We are also missing library ‘strscan.so’ - but StringScanner is
    built into IronRuby, so as a workaround, I changed the first line to:

require ‘strscan’ unless defined?(StringScanner)

More activesupport/activerecord observations should be coming soon. I
will add them to Wayne’s TowardsRails Wiki page at some point.

-Brian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs