Sinatra - undefined `join 'method for # <String> - after Gemfile.lock is removed

I tried to update the version of Ruby on Sinatra's website, on which I work 2.1.3

. When I tried to link, I had some errors. Then I removed Gemfile.lock

and bundle install

. But when I started the site I noticed something like

NoMethodError at /auth/login
undefined method `join' for #<String:0x000000062d3830>

      

My observations are as follows.

  • Go to Ruby 2.1.2 - issue persisted
  • Checked the project, as before ( Ruby 2.1.2

    with the old one Gemfile.lock

    ) worked
  • The error appeared with a tag yield_content(:head)

    .
    • Removed all tags yield_content

    • There was an error when displaying a thin file for a page - slim :index, :layout => :layout, :locals => body_locals

What could be a mistake? I created a Gemfile.lock

before and after state difference : https://gist.github.com/ziyan-junaideen/fb903abbdafdc2d4a02f

Terminal output error: https://gist.github.com/ziyan-junaideen/54bff4f05a5a7beeedff

I thought it was some SLIM bug and downgraded Slim to 2.0.3 which was before the package was installed, but no luck.

Any suggestion is greatly appreciated.

thank

+3


source to share


2 answers


I solved this by reinstalling thin and temple in slim: 2.0.3 and temple: 0.6.8 versions, this is probably in temple, "not enough to reduce the slack"



+2


source


I have this error too.

After some research I found that this is because the "output buffer" for rendering the template is an instance variable (by default this is the name @_out_buf

), so it gets overwritten when each (sub) template ends (because the partial objects are rendered at the same scope as the main template)

There are several ways to fix this without lowering sinatra / thin / temple:



  • The default outvar

    is _out_buf

    (local variable) @ lib / sinatra / base.rb # L814
  • Pass the outvar

    parameter slim

    , for example:== slim :sub_template, outvar: '_out_buf'

I also opened an issue in the synatra repo on github: https://github.com/sinatra/sinatra/issues/939 (let's see what the authors have to say about this)

+1


source







All Articles