Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uninitialized constant Base64

class Key < ActiveRecord::Base

  class << self

    def generate (key)
      Base64.encode64(key)
    end
  end
end

When calling Key.generate from a controller it works as expected. However, when calling Key.generate from a Rake::Task library I receive the error message:

uninitialized constant Base64

like image 664
user715697 Avatar asked Jun 06 '11 08:06

user715697


1 Answers

did you put require 'base64' inside application.rb after require 'rails/all'?

like image 84
Agung Prasetyo Avatar answered Oct 17 '22 08:10

Agung Prasetyo