I have the following sinatra application:
require 'rdiscount'
require 'sinatra'
class DocumentationApi < Sinatra::Application
set :views, '/app/docs'
get '/' do
erb :git_markdown, :locals => { :text => markdown(:api_docs) }
end
end
When I run this application in production, I'm getting warning logs because of way that ERB is being called by Sinatra. I believe that it's calling is happening in the following line: https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L866
The point is that way to call ERB.new is deprecated. At least is that what my warning messages are saying.
warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.
warning: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.
127.0.0.1 - - [15/Jun/2018:20:17:57 +0000] "GET / HTTP/1.1" 200 16326 0.0038
warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.
warning: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.
127.0.0.1 - - [15/Jun/2018:20:18:27 +0000] "GET / HTTP/1.1" 200 16326 0.0037
warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.
warning: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.
I believe that it's calling is happening in the following line: https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L866
Just saving the permalink for that URL. https://github.com/sinatra/sinatra/blob/1b35eaa7b8296313d48ec27e52955f10f35462fb/lib/sinatra/base.rb#L866
@ricardovsilva which Ruby version are you using? 2.6?
Some context:
@dentarg yes, I'm using ruby:2.6-rc-alpine docker image.
Hi, is this still open?
Can I try to fix this?
thx.
I investigated and noticed that this is Tilt's warning.
/.rbenv/versions/2.6.0-preview2/lib/ruby/gems/2.6.0/gems/tilt-2.0.8/lib/tilt/erb.rb:22: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
This is already solved by https://github.com/rtomayko/tilt/commit/4aff2d124e684c40240baf2d79d0ca1cd4cfc0f0 , thus there is nothing to do.
@kamina-zzz Thanks for investigating the issue. Let me know if you still have any concern or problems.
Most helpful comment
I investigated and noticed that this is
Tilt's warning.This is already solved by https://github.com/rtomayko/tilt/commit/4aff2d124e684c40240baf2d79d0ca1cd4cfc0f0 , thus there is nothing to do.