ruby on rails - "NameError - uninitialized constant" when running function from singleton model -
i'm getting "nameerror - uninitialized constant store::directededge" when call below statement controller.
store.instance.add_purchase(1, 2)
below singleton 'store' model:
require 'singleton' class store include singleton def initialize @database = directededge::database.new(env['directed_edge_username'], env['directed_edge_password']) end def add_purchase(user_id, product_id) item = directededge::item.new(@database, "user#{user_id}") item.link_to("product#{product_id}", "purchase") item.save end ... end
anyone have idea problem is?
try require directededge
require 'directed_edge'
. here link documentation directed edge example.
Comments
Post a Comment