[Ironruby-core] Running activerecord

Brian Blackwell brianblackwell at realemail.net
Thu Apr 24 21:19:55 EDT 2008

On Fri, 18 Apr 2008 15:56:32 -0700, "John Lam (IRONRUBY)"
<jflam at microsoft.com> 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

(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

(2) Problem with active_support/core_ext/logger.rb
:0:in `define_around_helper': wrong number or type of arguments for
`module_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 method
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 Kelly has confirmed
  that this is a parser bug (incorrect grammar) - see
  - As a workaround, I rewrote the above line as:

          loop do
            s = scanner.scan(char)
            if !s

  - 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: attr_internal.rb
Type: application/x-ruby
Size: 1193 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080425/91c5fb1c/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logger.rb
Type: application/x-ruby
Size: 875 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080425/91c5fb1c/attachment-0001.bin 

More information about the Ironruby-core mailing list