Heroku app fails to start - `require': no such file to load -- sinatratestapp (LoadError)
By the help of Heroku support request and this question I found out the solution.
Ruby 1.9.2 doesn't automatically include "." in the $LOAD_PATH. To workaround this, modify config.ru
by stating require './sinatratestapp'
instead of require 'sinatratestapp'
.
Rake tasks with Sinatra context on Heroku
It looks like the file where your settings are defined is not being loaded. In your config.ru
change require 'my_sinatra_app'
with require './my_sinatra_app'
. Also see this question.
Heroku Aplication error with Google charts
Finally, I used
gem "googlecharts"
which works pretty well.
Why does Ruby 1.9.2 remove . from LOAD_PATH, and what's the alternative?
It was deemed a "security" risk.
You can get around it by using absolute paths
File.expand_path(__FILE__) et al
or doing
require './filename' (ironically).
or by using
require_relative 'filename'
or adding an "include" directory
ruby -I . ...
or the same, using irb;
$irb -I .
Hosts file on Heroku
Don't use the WSDL. Call the functions directly. Like this:
#!ruby
require 'savon'
stock_handle = ARGV[0] || 'OTEX'
client = Savon::Client.new do
wsdl.endpoint = 'http://www.webservicex.net/stockquote.asmx'
wsdl.namespace = 'http://www.webserviceX.NET/'
end
response = client.request :wsdl, 'GetQuote' do
http.headers["SOAPAction"] = '"http://www.webserviceX.NET/GetQuote"'
soap.body = { "symbol" => stock_handle }
end
print response
How to automatically remove trailing whitespace in Visual Studio 2008?
CodeMaid is a very popular Visual Studio extension and does this automatically along with other useful cleanups.
- Download: https://github.com/codecadwallader/codemaid/releases/tag/v0.4.3
- Modern Download: https://marketplace.visualstudio.com/items?itemName=SteveCadwallader.CodeMaid
- Documentation: http://www.codemaid.net/documentation/#cleaning
I set it to clean up a file on save, which I believe is the default.
Related Topics
Simple Ruby Input Validation Library
Sinatra Static Assets Are Not Found When Using Rackup
I Can't Install Rmagick Gem on Windows
Mongoid: Find Through Array of Ids
How to Ignore Multiline Comments in SASS
How to Use Nokogiri::Xml::Reader to Parse Large Xml Files
Time_Ago_In_Words and Localize
Most Efficient Way to Calculate Hamming Distance in Ruby
Convert Array to Hash While Preserving Array Index Values in Ruby
Using Named Captures with Regex Match in Ruby's Case...When
I'm Getting "Found Character That Cannot Start Any Token While Scanning for the Next Token"
Strong Parameters Require Multiple
How to Safely Join Relative Url Segments
Ruby - Activerecord::Connectionnotestablished
How to Turn a Ruby Method into a Block