Search code examples
ruby-on-railsvideo-streamingopentoktokbox

uninitialized constant GroupsController::Opentok


I am trying to build an app using opentok.I am following a tutorial.in tutorial he used a method and called through before_filer.

private
def config_opentok
if @opentok.nil?
 @opentok = OpenTok::OpenTokSDK.new YOUR_API_KEY, YOUR_SECRET_TOKEN
end
end 

when i run the same code it shows..

uninitialized constant GroupsController::Opentok

how to initialize opentok instance variable.i changed YOUR_API_KEY and YOUR_SECRET_TOKEN to my own key and token.and i entered api_key without quotes and secret_token with quotes.

thanks in advance.


Solution

  • You should have the following line in your controller

    require "opentok"
    

    And use OpenTok::OpenTok instead of OpenTok::OpenTokSDK

    Source