0

I've trying to use the sharefile-ruby library, which is a wrapper for the ShareFile API.

There is no gem for it, so I believe I have to add the .rb file manually. Every library I've used I just install the gem, so I'm not sure what to do here.

Also, to use this library, would I just add require 'sharefile-ruby' in each controller I'm trying to use it in?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
xxyyxx
  • 2,306
  • 3
  • 24
  • 34
  • http://stackoverflow.com/questions/4074830/adding-lib-to-config-autoload-paths-in-rails-3-does-not-autoload-my-module – Sachin Singh Apr 11 '13 at 18:19

1 Answers1

3

The library is a single Ruby file. Just place the file somewhere in your app and require it with:

require 'sharefile-ruby'

Of course, if you place it in lib/foo/sharefile-ruby.rb then you'll need to use:

require 'foo/sharefile-ruby'

and so on.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
  • Is there any specific folder that these type of files are usually placed in? Rails is so oriented around convention, I just figured I can't go ahead and place this wherever I please. – xxyyxx Apr 11 '13 at 17:37
  • i'd recommend `require './sharefile-ruby'`. usually you would like to put such files in vendor/ folder - `require './vendor/sharefile-ruby'` –  Apr 11 '13 at 17:44
  • Awesome, thanks. And then I just require it in each controller I'm going to be using it in? Or is there way I can only require it once and then use it anywhere? – xxyyxx Apr 11 '13 at 17:49