ahnbizcad
ahnbizcad

Reputation: 10817

Correct rails Initializer method calls

This gem

https://github.com/patshaughnessy/auto_complete

instructs to use the following code for initializing

    Rails::Initializer.run do |config|
      config.gem "repeated_auto_complete"
    end

My config/environment.rb file looks like so.

# Load the Rails application.
require File.expand_path('../application', __FILE__)

# Initialize the Rails application.
MyPersonalityCharacters::Application.initialize!

# For repeated_auto_complete gem.
Rails::Initializer.run do |config|
  config.gem "repeated_auto_complete"
end

But the suggested code snippet in my config/environment.rb file throws an error, saying that Rails::Initializer is an uninitialized constant.

Am I using outdated syntax? It seems wrong to use two initializers.

Upvotes: 1

Views: 138

Answers (1)

Kostas Rousis
Kostas Rousis

Reputation: 6098

No, on the contrary, you use an up to date syntax.

The gem you refer to is rather outdated and I doubt that it would work with Rails 4.

As you can see on the GitHub page of the gem, there has been no update for more than 4 years. Moreover, the readme file specifies that it works with Rails 2.3. It was even shipped as a Rails plugin. I would suggest you find another gem to do what you want.

Upvotes: 2

Related Questions