As soon as I add code to access my .sqlite database, I get a strange error:
in 'total': uninitialized constant Test2::SQLite (NameError)
My code is as follows:
Test1.rb
require_relative 'Test2.rb'
co = Test2.new()
price = co.total
Test2.rb
require 'sqlite3'
class Test2
def initialize()
@items = []
end
def total()
db = SQLite::Database.open "Database.sqlite"
db.close()
return 0
end
end
The
SQLitemodule doesn’t exist, but it is namedSQLite3(check the docs):