I got this error
NameError in WelcomeController#index
uninitialized constant YouTubeIt
Rails.root: C:/Sites/rails_code/youtube
Btw i checked the gem
author github
, checked sintax of constant, seems everything's alright, so i can't figure it out.
There is a very similar question here:
But in his case, there was a typo, i don't have any typo, i even checked the tutorial like 6 times, but there's no apparent error on my side, here's my controller
code:
class WelcomeController < ApplicationController
def index
@cliente = ::YouTubeIt::Client.new(:dev_key => "AI39si4Ao5BFsYIkbzko7b9A_iktB2Pc8DAblJJ_JzJx6IL6Mju1dYYkMKY6TByz8MJPXfm4__tCAt9Is6Mvjg2JM55kuJVVqQ")
@videos = @cliente.videos_by(user: "AlbertoMaso2")
end
end
already installed the youtube_it
and declared it's presence in the app by adding it to the Gemfile
.
I'm stuck on this one and can't get it to work.
Anyone can shed some light upon this?
Thanks in advance!
When you have changed Gemfile
, or added a new gem to it, please, make sure that you have updated Gemfile.lock
also. To update lock file just run bundle install
command.
Then in order to check usability the gem, you could not run whole rails server, but simply rails console with loaded development
environment. Do it as follows:
$ rails c
or
$ rails console
Then inside the IRB
, you can try your new gem features, in your case as follows:
irb(main):001:0> require 'youtube_it'
=> true
irb(main):002:0> YouTubeIt
=> YouTubeIt