4

I have an Rails application which I am attempting to include the faye ruby gem.
I have installed faye with

gem install faye 

and added a faye.ru to my root rails app. folder:

require 'faye'
Faye::WebSocket.load_adapter('thin')
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
run faye_server

When I want to start faye with:

rackup -s thin -E production config.ru 

I only get:

`require': cannot load such file -- faye

How do I address this issue?

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
phil
  • 65
  • 6

3 Answers3

2

You need to include it in your Gemfile:

gem 'faye'

Then run bundle install, this make the gem available to your application.

Also consider gem 'faye', require: 'faye' to make the loaded gem available to your entire application.

rudolph9
  • 8,021
  • 9
  • 50
  • 80
  • @phil no problem... You should check out the book [Agile Web Development with Rails](http://pragprog.com/book/rails4/agile-web-development-with-rails), the way you are approaching the _development_ of your rails app is making it _way_ more difficult than it is supposed to be (putting files into the root of your app, testing in a production environment, loading library/gems directly into the files of the app, etc.... basically not having to do these types of things is exactly why people use rails). – rudolph9 Nov 08 '12 at 17:58
0

require 'rubygems' on the top of your faye.ru (before the require 'faye') will probably resolve this.

doesterr
  • 3,955
  • 19
  • 26
0

For my case, just add bundle exec before the command and it worked.

bundle exec rackup faye.ru -E production -s thin

javier_domenech
  • 5,995
  • 6
  • 37
  • 59
user1519372
  • 31
  • 1
  • 3