Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

rails3 breaks base64 stdlib?

#3961

Rails 3.0.0.beta seems to break the base64 in the stdlib. See below.

I'm aware of ActiveSupport::Base64.encode64 in the meantime.

    $ irb
    ruby-1.9.1-p378 > require 'base64'
    => true 
    ruby-1.9.1-p378 > Base64.b64encode('blah')
    YmxhaA==
    => "YmxhaA==\n" 


    $ rails console
    Loading development environment (Rails 3.0.0.beta)
    ruby-1.9.1-p378 > require 'base64'
    => [] 
    ruby-1.9.1-p378 > Base64.b64encode('blah')
    NoMethodError: undefined method `b64encode' for Base64:Module
            from (irb):1
            from /Users/daniel/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta/lib/rails/commands/console.rb:47:in `start'
            from /Users/daniel/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta/lib/rails/commands/console.rb:8:in `start'
            from /Users/daniel/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta/lib/rails/commands.rb:34:in `<top (required)>'
            from /Users/daniel/km/survey/srails/script/rails:10:in `require'
            from /Users/daniel/km/survey/srails/script/rails:10:in `<main>'

Reported by eydaimon · February 15th, 2010 @ 05:06 AM

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. eydaimon
    eydaimon
    • Tag changed from base64 stdlib to base64, stdlib

    February 15th, 2010 @ 05:08 AM

  2. Jens Fahnenbruck
    Jens Fahnenbruck
    • Tag changed from base64, stdlib to 1.9.1, base64, stdlib

    +1 I can reproduce it in ruby 1.9.1 but it worked in ruby 1.8.7

    February 16th, 2010 @ 08:14 PM

  3. isomorphix
    isomorphix

    I noticed the same thing, but it looks like this is a change between Ruby 1.8 and Ruby 1.9 and not a problem with Rails. According to the Ruby 1.9 Rdoc, that method does not exist, while the Ruby 1.8.6 Rdoc does have b64encode.

    In addition, a plain irb session in Ruby 1.9.1-p378 behaves identically to what you experienced in the rails console. Rails is mentioned in the stack trace because you used the rails console instead of irb.

    $ irb
    ruby-1.9.1-p378 > require 'base64'
     => true 
    ruby-1.9.1-p378 > Base64.b64encode('blah')
    NoMethodError: undefined method `b64encode' for Base64:Module
        from (irb):2
        from /Users/isomorphix/.rvm/rubies/ruby-1.9.1-p378/bin/irb:17:in `<main>'
    ruby-1.9.1-p378 >
    

    February 24th, 2010 @ 10:30 PM

  4. José Valim
    José Valim
    • State changed from new to invalid

    March 26th, 2010 @ 10:50 PM

  5. eydaimon
    eydaimon

    Jose:

    please add some explanation why it was marked invalid?

    It's pretty clear I'm not able to use it, regardless of what isomorphix said, and I hope you didn't close it only based on what he said.

    i.e. I can use it just fine in irb, but it does not behave as expected in rails.

    March 27th, 2010 @ 02:02 AM