Sinatra: Sinatra is calling ERB.new in a deprecated way

Created on 15 Jun 2018  路  7Comments  路  Source: sinatra/sinatra

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.

Most helpful comment

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.

All 7 comments

@ricardovsilva which Ruby version are you using? 2.6?

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

singram picture singram  路  4Comments

namusyaka picture namusyaka  路  5Comments

paulmenzel picture paulmenzel  路  4Comments

Harishkris picture Harishkris  路  3Comments

Joshfindit picture Joshfindit  路  8Comments