Question

I'm wanting to build an app where I can search for videos on YouTube. It seems the most popular choice is youtube_it gem for doing so.

I added the gem to my Gemfile, and run bundle install. When I do bundle query --local I can see that the gem is preset (version 2.1.4).

So, according to the README it seems to me I should do something like this in my controller(?):

class ConsoleController < ApplicationController  
  .
  .
  .

  def search
    require 'youtube_it'
    client = YouTubeIt::Client.new(:dev_key => "my developer key")
  end
end

But I get "cannot load such file -- youtube_it" error

If I remove the require function, I get "uninitialized constant ConsoleController::YouTubeIt" error.

Does anyone know what I'm doing wrong here?

UPDATE:

/Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.0.3)
      actionpack (= 4.0.3)
      mail (~> 2.5.4)
    actionpack (4.0.3)
      activesupport (= 4.0.3)
      builder (~> 3.1.0)
      erubis (~> 2.7.0)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    activemodel (4.0.3)
      activesupport (= 4.0.3)
      builder (~> 3.1.0)
    activerecord (4.0.3)
      activemodel (= 4.0.3)
      activerecord-deprecated_finders (~> 1.0.2)
      activesupport (= 4.0.3)
      arel (~> 4.0.0)
    activerecord-deprecated_finders (1.0.3)
    activesupport (4.0.3)
      i18n (~> 0.6, >= 0.6.4)
      minitest (~> 4.2)
      multi_json (~> 1.3)
      thread_safe (~> 0.1)
      tzinfo (~> 0.3.37)
    addressable (2.3.6)
    arel (4.0.2)
    bcrypt (3.1.7)
    bootstrap-sass (3.1.1.1)
      sass (~> 3.2)
    builder (3.1.4)
    capybara (2.2.1)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    coderay (1.1.0)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.7.0)
    devise (3.2.4)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    diff-lcs (1.2.5)
    erubis (2.7.0)
    execjs (2.0.2)
    factory_girl (4.2.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.2.1)
      factory_girl (~> 4.2.0)
      railties (>= 3.0.0)
    haml (4.0.5)
      tilt
    haml-rails (0.5.3)
      actionpack (>= 4.0.1)
      activesupport (>= 4.0.1)
      haml (>= 3.1, < 5.0)
      railties (>= 4.0.1)
    hike (1.2.3)
    i18n (0.6.9)
    jbuilder (1.5.3)
      activesupport (>= 3.0.0)
      multi_json (>= 1.2.0)
    jquery-rails (3.1.0)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.1)
    launchy (2.4.2)
      addressable (~> 2.3)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    method_source (0.8.2)
    mime-types (1.25.1)
    mini_portile (0.5.3)
    minitest (4.7.5)
    multi_json (1.9.3)
    nokogiri (1.6.1)
      mini_portile (~> 0.5.0)
    orm_adapter (0.5.0)
    pg (0.17.1)
    polyglot (0.3.4)
    pry (0.9.12.6)
      coderay (~> 1.0)
      method_source (~> 0.8)
      slop (~> 3.4)
    pry-rails (0.3.2)
      pry (>= 0.9.10)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.0.3)
      actionmailer (= 4.0.3)
      actionpack (= 4.0.3)
      activerecord (= 4.0.3)
      activesupport (= 4.0.3)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.0.3)
      sprockets-rails (~> 2.0.0)
    railties (4.0.3)
      actionpack (= 4.0.3)
      activesupport (= 4.0.3)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.3.1)
    rdoc (4.1.1)
      json (~> 1.4)
    rspec-core (2.14.8)
    rspec-expectations (2.14.5)
      diff-lcs (>= 1.1.3, < 2.0)
    rspec-mocks (2.14.6)
    rspec-rails (2.14.2)
      actionpack (>= 3.0)
      activemodel (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 2.14.0)
      rspec-expectations (~> 2.14.0)
      rspec-mocks (~> 2.14.0)
    sass (3.2.19)
    sass-rails (4.0.3)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.2.0)
      sprockets (~> 2.8, <= 2.11.0)
      sprockets-rails (~> 2.0)
    sdoc (0.4.0)
      json (~> 1.8)
      rdoc (~> 4.0, < 5.0)
    slop (3.5.0)
    sprockets (2.11.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.0.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    thor (0.19.1)
    thread_safe (0.3.3)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (2.2.2)
      coffee-rails
    tzinfo (0.3.39)
    uglifier (2.5.0)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    warden (1.2.3)
      rack (>= 1.0)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  bootstrap-sass (~> 3.1.1)
  capybara
  coffee-rails (~> 4.0.0)
  devise
  factory_girl_rails (~> 4.2.1)
  haml-rails
  jbuilder (~> 1.2)
  jquery-rails
  launchy (~> 2.4.2)
  pg
  pry-rails
  rails (= 4.0.3)
  rspec-rails
  sass-rails (~> 4.0.0)
  sdoc
  turbolinks
  uglifier (>= 1.3.0)
Was it helpful?

Solution

It seems that youtube_it gem is still not installed. Double check that gem 'youtube_it' is included in Gemfile and run bundle update

Alternatively you can also delete Gemfile.lock and then run bundle install

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top