theReverseFlick
theReverseFlick

Reputation: 6044

How to use ruby libraries in rails?

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

Upvotes: 1

Views: 1501

Answers (4)

Simone Carletti
Simone Carletti

Reputation: 176372

There's an official Rails guide about this topic.

Upvotes: 2

Ivan
Ivan

Reputation: 103859

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.

Upvotes: 4

ryudice
ryudice

Reputation: 37366

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'

Upvotes: 0

Marek Sapota
Marek Sapota

Reputation: 20591

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

Upvotes: 2

Related Questions