mikecmpbll / betfair

Ruby library for the Betfair Exchange API.
MIT License
17 stars 20 forks source link

Add hint when working with rails #7

Closed caveman-dick closed 8 years ago

caveman-dick commented 8 years ago

I recently had this problem with your gem when migrating my script into a rails application. Not sure if this is the best approach (fairly new to ruby) so feel free to reject if there is a better way around this issue.

Thanks

mikecmpbll commented 8 years ago

hey there. ah .. this shouldn't be necessary. it's probably because the gem name isn't the same as the file it needs to require. typically if the gem is called 'betfair-ng' bundler (or rails?) will automatically require 'betfair-ng' from the loadpath (including whatever load path the gem adds, which is typically lib/ from the gem root.)

you should be able to get around this by changing your gemfile to:

gem 'betfair-ng', require: 'betfair'

i agree we should change the docs to make this clear or add a betfair-ng.rb which just loads betfair.rb.

caveman-dick commented 8 years ago

Thanks for that, it makes a lot more sense now and works perfectly! :smile: