This project is archived and is in readonly mode.

#3961 ✓invalid
eydaimon

rails3 breaks base64 stdlib?

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

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

Comments and changes to this ticket

  • eydaimon

    eydaimon February 15th, 2010 @ 05:08 AM

    • Tag changed from base64 stdlib to base64, stdlib
  • Jens Fahnenbruck

    Jens Fahnenbruck February 16th, 2010 @ 08:14 PM

    • 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

  • isomorphix

    isomorphix February 24th, 2010 @ 10:30 PM

    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 >
    
  • José Valim

    José Valim March 26th, 2010 @ 10:50 PM

    • State changed from “new” to “invalid”
  • eydaimon

    eydaimon March 27th, 2010 @ 02:02 AM

    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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages