1

I just installed a ruby gem

 gem install anemone

But I cannot hit off to use it directly in my rails application, this is the first time I'm using an external ruby library so it will be very helpful if you can give me an insight into it rather than just a solution

Cheers

theReverseFlick
  • 5,894
  • 8
  • 32
  • 33

4 Answers4

4

In your Gemfile add:

gem 'anemone'

This way Rails will load the library when it starts, and you can then use it. You don't even have to use the require keyword.

Ivan
  • 97,549
  • 17
  • 50
  • 58
2

You must put used libraries into Gemfile. Everything about gemfiles is available on Bundler page.

Marek Sapota
  • 20,103
  • 3
  • 34
  • 47
2

There's an official Rails guide about this topic.

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

You also need to use 'require' and the name of the library on top of the file where you want to use the library. For example if you are using nokogiri you would need to add the line require 'nokogiri'

ryudice
  • 36,476
  • 32
  • 115
  • 163