0
class DomaincheckerController < ApplicationController
  def index
  end
  def store
    r =Whois.whois(secure_params['domain'])
    render :text => "#{r}"
  end

  private
  def secure_params
    params.require(:whois).permit(:domain)
  end


end

This is my domainchecker controller. The index method renders a form. After submitting the form it goes to store method. Here I am trying to use the whois gem. I have installed whois gem by running gem install whois. But I am getting this error.

uninitialized constant DomaincheckerController::Whois 
Raaz
  • 1,669
  • 2
  • 24
  • 48

1 Answers1

1

The problem is that you installed the gem directly and not using bundler, therefore the Rails app can't find the dependency.

In order to install a gem in a Rails project you need to edit the Gemfile file and add the gem there. Once added, run

$ bundle

in order to install the dependency. Check the documentation about the Gemfile.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364