Base64 uninitialized constant

class Key < ActiveRecord::Base class << self def generate (key) Base64.encode64(key) end end end 

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

base64 uninitialized constant

+7
source share
1 answer

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

+12
source

All Articles