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
did you put
require 'base64'insideapplication.rbafterrequire 'rails/all'?