Rack / Sinatra LoadError: unable to load such a file

I am trying to build an application using Sinatra, Ruby, rack, haml, pony and SendGrid, with git and RVM to deploy to Heroku. The application is a variant of the blog, which should send an email with a comment on the form. On my local server, when the form submits, I get the following error:

LoadError at /
cannot load such file -- pony
file: tools.rb location: require line: 314
BACKTRACE
(expand)
/Users/Kevin/prog/ruby/Sinatra/Noobs/noobs.rb in block in <top (required)>
  require 'pony'

When launched on Heroku, the submit form results in an internal server error. The error "download such a file" indicates that the file is not on the path to gem, but if I understand correctly, the OS does not agree:

➜  noobs git:(master) ✗ bundle show pony
/Users/Kevin/.rvm/gems/ruby-1.9.3-p194@noobs/gems/pony-1.4

➜  noobs git:(master) echo $GEM_PATH
/Users/Kevin/.rvm/gems/ruby-1.9.3-p194@noobs:/Users/Kevin/.rvm/gems/ruby-1.9.3-p194@global

Here is the code where a pony is required (noobs.rb):

require 'rubygems'
require 'sinatra'
require 'haml'
require "sinatra/reloader" if development?  

# ...

post '/' do
  require 'pony'
  Pony.mail(:from => params[:name] + "<" + params[:contact] + ">",

What do I need to do to make a pony work?

+6
source share
2 answers
require "bundler/setup"

, .

Bundler Sinatra, , Bundler . , Bundler gemset. Sinatra Haml gemset, Pony Gemfile LoadError.

+11

( - ) Gemfile - . Jemfile - jem "pony" , paste2.org/6hVxHXKH

0

All Articles