jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • JRuby
  • JRUBY-1518

Cannot call to_yaml on ActiveRecord object with has_many with Rails 2.0

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Cannot Reproduce
  • Affects Version/s: JRuby 1.0.2
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Hide
    CentOS 5, ruby 1.8.5 (2007-11-03 rev 4810) [i386-jruby1.0.2]

    Rails 2.0 is installed:

    [james@ceantar rfs]$ gem list

    *** LOCAL GEMS ***

    actionmailer (1.3.5.7919, 1.3.5)
        Service layer for easy email delivery and testing.

    actionpack (1.13.5.7919, 1.13.5)
        Web-flow and rendering framework putting the VC in MVC.

    actionwebservice (1.2.5)
        Web service support for Action Pack.

    activerecord (1.15.5.7919, 1.15.5)
        Implements the ActiveRecord pattern for ORM.

    ActiveRecord-JDBC (0.5)
        JDBC adapter for ActiveRecord, for use within JRuby on Rails.

    activeresource (0.9.0.7919)
        Think Active Record for web resources.

    activesupport (1.4.4.7919, 1.4.4)
        Support and utility classes used by the Rails framework.

    aws-s3 (0.4.0)
        Client library for Amazon's Simple Storage Service's REST API

    builder (2.1.2)
        Builders for MarkUp.

    daemons (1.0.8)
        A toolkit to create and control daemons in different ways

    highline (1.4.0)
        HighLine is a high-level command-line IO library.

    hoe (1.3.0)
        Hoe is a way to write Rakefiles much easier and cleaner.

    jruby-openssl (0.0.4)
        JRuby OpenSSL

    mime-types (1.15)
        Manages a MIME Content-Type that will return the Content-Type for a
        given filename.

    mocha (0.5.5)
        Mocking and stubbing library

    multi (0.1)
        Multiple Dispatch/Pattern Matching for Ruby

    named_arguments (0.0.5)
        The author was too lazy to write a summary

    needle (1.3.0)
        Needle is a Dependency Injection/Inversion of Control container for
        Ruby. It supports both type-2 (setter) and type-3 (constructor)
        injection. It takes advantage of the dynamic nature of Ruby to
        provide a rich and flexible approach to injecting dependencies.

    net-sftp (1.1.0)
        Net::SFTP is a pure-Ruby implementation of the SFTP client protocol.

    net-ssh (1.1.2)
        Net::SSH is a pure-Ruby implementation of the SSH2 client protocol.

    open4 (0.9.6)
        open4

    optiflag (0.6.5)
        OptiFlag is an embeddable DSL library for declaring and using
        command-line options/flags in any Ruby program.

    rails (1.2.5.7919, 1.2.5)
        Web-application framework with template engine, control-flow layer,
        and ORM.

    rake (0.7.3)
        Ruby based make-like utility.

    restphone (0.0.1)
        RESTPhone adds a telephone interface to your Ruby on Rails
        applications.

    right_aws (1.4.3)
        Interface classes for the Amazon EC2, SQS, and S3 Web Services

    right_http_connection (1.2.0)
        RightScale's robust HTTP/S connection module

    rspec (1.0.8)
        RSpec-1.0.8 (r2338) - BDD for Ruby http://rspec.rubyforge.org/

    rubyforge (0.4.4)
        A script which automates a limited set of rubyforge operations.

    sources (0.0.1)
        This package provides download sources for remote gem installation

    sqlup (0.0.13)
        A backup tool for saving MySQL data to Amazon's S3 service

    test-spec (0.4.0)
        test/spec layers an RSpec-inspired interface on top of Test::Unit,
        so you can mix TDD and BDD (Behavior-Driven Development). test/spec
        is a clean-room implementation that maps most kinds of Test::Unit
        assertions to a `should'-like syntax.

    tzinfo (0.3.5)
        Daylight-savings aware timezone library

    vlad (1.1.0)
        Vlad the Deployer is pragmatic application deployment automation,
        without mercy. Much like Capistrano, but with 1/10th the complexity.
        Vlad integrates seamlessly with Rake, and uses familiar and standard
        tools like ssh and rsync.

    xml-simple (1.0.11)
        A very simple API for XML processing.
    [james@ceantar rfs]$
    Show
    CentOS 5, ruby 1.8.5 (2007-11-03 rev 4810) [i386-jruby1.0.2] Rails 2.0 is installed: [james@ceantar rfs]$ gem list *** LOCAL GEMS *** actionmailer (1.3.5.7919, 1.3.5)     Service layer for easy email delivery and testing. actionpack (1.13.5.7919, 1.13.5)     Web-flow and rendering framework putting the VC in MVC. actionwebservice (1.2.5)     Web service support for Action Pack. activerecord (1.15.5.7919, 1.15.5)     Implements the ActiveRecord pattern for ORM. ActiveRecord-JDBC (0.5)     JDBC adapter for ActiveRecord, for use within JRuby on Rails. activeresource (0.9.0.7919)     Think Active Record for web resources. activesupport (1.4.4.7919, 1.4.4)     Support and utility classes used by the Rails framework. aws-s3 (0.4.0)     Client library for Amazon's Simple Storage Service's REST API builder (2.1.2)     Builders for MarkUp. daemons (1.0.8)     A toolkit to create and control daemons in different ways highline (1.4.0)     HighLine is a high-level command-line IO library. hoe (1.3.0)     Hoe is a way to write Rakefiles much easier and cleaner. jruby-openssl (0.0.4)     JRuby OpenSSL mime-types (1.15)     Manages a MIME Content-Type that will return the Content-Type for a     given filename. mocha (0.5.5)     Mocking and stubbing library multi (0.1)     Multiple Dispatch/Pattern Matching for Ruby named_arguments (0.0.5)     The author was too lazy to write a summary needle (1.3.0)     Needle is a Dependency Injection/Inversion of Control container for     Ruby. It supports both type-2 (setter) and type-3 (constructor)     injection. It takes advantage of the dynamic nature of Ruby to     provide a rich and flexible approach to injecting dependencies. net-sftp (1.1.0)     Net::SFTP is a pure-Ruby implementation of the SFTP client protocol. net-ssh (1.1.2)     Net::SSH is a pure-Ruby implementation of the SSH2 client protocol. open4 (0.9.6)     open4 optiflag (0.6.5)     OptiFlag is an embeddable DSL library for declaring and using     command-line options/flags in any Ruby program. rails (1.2.5.7919, 1.2.5)     Web-application framework with template engine, control-flow layer,     and ORM. rake (0.7.3)     Ruby based make-like utility. restphone (0.0.1)     RESTPhone adds a telephone interface to your Ruby on Rails     applications. right_aws (1.4.3)     Interface classes for the Amazon EC2, SQS, and S3 Web Services right_http_connection (1.2.0)     RightScale's robust HTTP/S connection module rspec (1.0.8)     RSpec-1.0.8 (r2338) - BDD for Ruby http://rspec.rubyforge.org/ rubyforge (0.4.4)     A script which automates a limited set of rubyforge operations. sources (0.0.1)     This package provides download sources for remote gem installation sqlup (0.0.13)     A backup tool for saving MySQL data to Amazon's S3 service test-spec (0.4.0)     test/spec layers an RSpec-inspired interface on top of Test::Unit,     so you can mix TDD and BDD (Behavior-Driven Development). test/spec     is a clean-room implementation that maps most kinds of Test::Unit     assertions to a `should'-like syntax. tzinfo (0.3.5)     Daylight-savings aware timezone library vlad (1.1.0)     Vlad the Deployer is pragmatic application deployment automation,     without mercy. Much like Capistrano, but with 1/10th the complexity.     Vlad integrates seamlessly with Rake, and uses familiar and standard     tools like ssh and rsync. xml-simple (1.0.11)     A very simple API for XML processing. [james@ceantar rfs]$

Description

Create an object with a has_many relationship, then call to_yaml on it.

require File.dirname(_FILE_) + '/../test_helper'

class FooTest < Test::Unit::TestCase

  1. Replace this with your real tests.
    def test_truth
    f = Foo.create :name => 'f1'
    b = f.bars.create(:barname => 'b')
    f.to_yaml
    end
    end

You'll see:

1) Error:
test_truth(FooTest):
NoMethodError: undefined method `value' for #<String:0x62ad0d>
/tmp/tst/./test/unit/foo_test.rb:8:in `test_truth'

(I've included a project that repros the issue)

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. GZip Archive
    tstproj.tar.gz
    04/Nov/07 12:22 PM
    70 kB
    James Moore

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
James Moore added a comment - 04/Nov/07 1:31 PM

1.1 has an issue with this as well:

[james@ceantar tst]$ jruby -v
ruby 1.8.5 (2007-11-01 rev 4842) [i386-jruby1.1b1]

[james@ceantar tst]$ rake
(in /tmp/tst)
/bin/sh: gdiff: command not found
/home/james/jruby-1.1b1/bin/jruby -Ilib:test "/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb" "test/unit/foo_test.rb" "test/unit/bar_test.rb"
Loaded suite /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader
Started
.E
Finished in 0.364 seconds.

1) Error:
test_truth(FooTest):
NoMethodError: undefined method `value' for #<String:0x8b28e0>
/tmp/tst/./test/unit/foo_test.rb:8:in `test_truth'

2 tests, 1 assertions, 0 failures, 1 errors
/home/james/jruby-1.1b1/bin/jruby -Ilib:test "/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb" "test/functional/foos_controller_test.rb" "test/functional/bars_controller_test.rb"
Loaded suite /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader
Started
..............
Finished in 0.981 seconds.

14 tests, 26 assertions, 0 failures, 0 errors
/home/james/jruby-1.1b1/bin/jruby -Ilib:test "/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb"
Errors running test:units!
/home/james/jruby-1.1b1/bin/jruby -w -Ilib:ext:bin:test -e 'require "test/test_helper.rb"; require "test/unit"'
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/validations.rb:403 warning: `*' interpreted as argument prefix
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/validations.rb:436 warning: `*' interpreted as argument prefix
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/migration.rb:226 warning: instance variable @ignore_new_methods not initialized
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/migration.rb:226 warning: instance variable @ignore_new_methods not initialized
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/attribute_methods.rb:8 warning: `*' interpreted as argument prefix
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/connection_adapters/abstract/schema_definitions.rb:196 warning: `*' interpreted as argument prefix
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/connection_adapters/abstract/schema_definitions.rb:203 warning: `*' interpreted as argument prefix
(erb):32 warning: Useless use of a variable in void context.
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/observer.rb:35 warning: instance variable @observers not initialized
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/action_controller/routing.rb:1254 warning: instance variable @routes_last_modified not initialized
Loaded suite -e
Started

Finished in 0.0020 seconds.

0 tests, 0 assertions, 0 failures, 0 errors
/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/action_controller/integration.rb:86 warning: `*' interpreted as argument prefix

Show
James Moore added a comment - 04/Nov/07 1:31 PM 1.1 has an issue with this as well: [james@ceantar tst]$ jruby -v ruby 1.8.5 (2007-11-01 rev 4842) [i386-jruby1.1b1] [james@ceantar tst]$ rake (in /tmp/tst) /bin/sh: gdiff: command not found /home/james/jruby-1.1b1/bin/jruby -Ilib:test "/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb" "test/unit/foo_test.rb" "test/unit/bar_test.rb" Loaded suite /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader Started .E Finished in 0.364 seconds. 1) Error: test_truth(FooTest): NoMethodError: undefined method `value' for #<String:0x8b28e0> /tmp/tst/./test/unit/foo_test.rb:8:in `test_truth' 2 tests, 1 assertions, 0 failures, 1 errors /home/james/jruby-1.1b1/bin/jruby -Ilib:test "/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb" "test/functional/foos_controller_test.rb" "test/functional/bars_controller_test.rb" Loaded suite /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader Started .............. Finished in 0.981 seconds. 14 tests, 26 assertions, 0 failures, 0 errors /home/james/jruby-1.1b1/bin/jruby -Ilib:test "/home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb" Errors running test:units! /home/james/jruby-1.1b1/bin/jruby -w -Ilib:ext:bin:test -e 'require "test/test_helper.rb"; require "test/unit"' /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/validations.rb:403 warning: `*' interpreted as argument prefix /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/validations.rb:436 warning: `*' interpreted as argument prefix /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/migration.rb:226 warning: instance variable @ignore_new_methods not initialized /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/migration.rb:226 warning: instance variable @ignore_new_methods not initialized /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/attribute_methods.rb:8 warning: `*' interpreted as argument prefix /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/connection_adapters/abstract/schema_definitions.rb:196 warning: `*' interpreted as argument prefix /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/connection_adapters/abstract/schema_definitions.rb:203 warning: `*' interpreted as argument prefix (erb):32 warning: Useless use of a variable in void context. /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/active_record/observer.rb:35 warning: instance variable @observers not initialized /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/action_controller/routing.rb:1254 warning: instance variable @routes_last_modified not initialized Loaded suite -e Started Finished in 0.0020 seconds. 0 tests, 0 assertions, 0 failures, 0 errors /home/james/jruby-1.1b1/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/action_controller/integration.rb:86 warning: `*' interpreted as argument prefix
Hide
Permalink
Charles Oliver Nutter added a comment - 07/Nov/07 12:50 AM

If you can do any more footwork on this, it would help us make some progress...

Show
Charles Oliver Nutter added a comment - 07/Nov/07 12:50 AM If you can do any more footwork on this, it would help us make some progress...
Hide
Permalink
James Moore added a comment - 07/Nov/07 5:30 PM

I should have time to do more investigating next week - I'd like to see if I can't get my new project up and running on JRuby, and this bug is killing it right now (it's using YAML to (de)serialize a bunch of ActiveResource stuff).

Show
James Moore added a comment - 07/Nov/07 5:30 PM I should have time to do more investigating next week - I'd like to see if I can't get my new project up and running on JRuby, and this bug is killing it right now (it's using YAML to (de)serialize a bunch of ActiveResource stuff).
Hide
Permalink
James Moore added a comment - 26/Nov/07 11:55 AM

I'm not seeing this problem in trunk (r5054).

Show
James Moore added a comment - 26/Nov/07 11:55 AM I'm not seeing this problem in trunk (r5054).
Hide
Permalink
James Moore added a comment - 26/Nov/07 11:56 AM

Closing, since it appears to be fixed.

Show
James Moore added a comment - 26/Nov/07 11:56 AM Closing, since it appears to be fixed.

People

  • Assignee:
    Thomas E Enebo
    Reporter:
    James Moore
Vote (0)
Watch (1)

Dates

  • Created:
    04/Nov/07 12:22 PM
    Updated:
    23/Apr/08 10:09 AM
    Resolved:
    26/Nov/07 11:56 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.