Template rendering moved to Erubi in Rails master (see rails/rails#27757), this generated a depreciation notice in the HAML gem :
rake webpacker:DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead. (called from require at /Users/renchap/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/haml-4.0.7/lib/haml/helpers/safe_erubis_template.rb:3)
@renchap Could you try master and check if it's fixed? Thanks!
Seems to work fine, no more warning ! 👍
Installing 5.1.0 beta now and getting this warning. What should I do to get rid of it?
Appreciate your help.
@ayb 5.0.0.beta.2 gem is out: https://rubygems.org/gems/haml/versions/5.0.0.beta.2
Please try bundling this gem.
Would it be possible to cut a release with this fix? We're hoping to do Rails 5.1 RC1 this week and would be lovely if people using both could avoid this. Thanks!
I'm sure! @amatsuda does that sound good to you?
Yes, I guess we need to investigate #908, then soon I'll push 5.0.0 stable :)
Would love to see this pushed soon, this is holding up my Rails 5.1 testing!
DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead
I have error in Rails 5.1.0 rc1 Is this supposed to be ? Don't know what to do
Write following code to Gemfile and execute bundle update
.
gem 'haml', '5.0.0.beta.2'
Gemfile
gem 'haml', '5.0.0.beta.2' with or w/o gem 'haml-rails'
error:
SyntaxError - syntax error, unexpected tSTRING_DEND, expecting ')'
attribute_compiler1 = ("page"}.merge(cache); case (_haml_att
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:20: syntax error, unexpected tSTRING_DEND, expecting '}'
=> _haml_attribute_compiler1 }, nil)).to_s);; when true; _ha
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:20: syntax error, unexpected ')', expecting keyword_end
ibute_compiler1 }, nil)).to_s);; when true; _hamlout.buffer
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:20: syntax error, unexpected keyword_when, expecting ')'
< (" data-role".freeze);; when false, nil; else; _hamlout.bu
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:20: Can't assign to false
ta-role".freeze);; when false, nil; else; _hamlout.buffer <<
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:20: Can't assign to nil
le".freeze);; when false, nil; else; _hamlout.buffer << (" d
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:20: syntax error, unexpected ';', expecting '='
le".freeze);; when false, nil; else; _hamlout.buffer << (" d
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:20: syntax error, unexpected keyword_end, expecting ')'
t.buffer << ("'".freeze);; end; _hamlout.buffer << (">\n<div
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:21: syntax error, unexpected '}', expecting ')'
tribute_compiler2 = ("header"}.merge(backbtn); case (_haml_a
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:27: syntax error, unexpected keyword_ensure, expecting ')'
Util.html_safe(_erbout);ensure;@haml_buffer = @haml_buffer.u
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:27: syntax error, unexpected keyword_end, expecting ')'
ffer.upper if @haml_buffer;end;
^
/Users/kul/mindapp/a241510/app/views/layouts/_full.haml:30: syntax error, unexpected keyword_end, expecting ')'
end
^:
app/views/layouts/_full.haml:20:in `'
actionview (5.1.0.rc1) lib/action_view/template.rb:307:in `compile'
Oh, that seems another bug.
@kul1 Could you paste /Users/kul/mindapp/a241510/app/views/layouts/_full.haml
(with some modification)? Around line 20-30.
Here the Gemfile
And the code for _full.haml
!!! 5
%html
%head
%meta(name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1")
= stylesheet_link_tag "application"
= javascript_include_tag "application"
- if GMAP
= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false"
%body
= render :partial => "mindapp/menu"
%div{"data-id" => "main", "data-role" => "panel", "data-backbtn"=>"false"}
- if @cache
- cache = {}
- else
- cache = {"data-cache"=>"never"}
- if @backbtn
- backbtn= {"data-backbtn"=>"true"}
- else
- backbtn= {"data-backbtn"=>"false"}
%div{{"data-role" => "page"}.merge(cache) }
%div{{"data-role" => "header"}.merge(backbtn)}
%h1= @title || DEFAULT_TITLE
%div{"data-role" => "content"}
= yield
= render :partial => "mindapp/static"
Ah, it was open source. That's very helpful :)
Maybe we have a bug in compiler for following code:
https://github.com/kul1/a241510/blob/61ba19a5a4856520a96feebd23d147fa6968e30c/app/views/layouts/_full.haml#L20-L21
I'll see that later... That might be fixed easily. Just a moment please.
@kul1 Fixed this issue on master, in https://github.com/haml/haml/commit/5688fcc2e04f5cb482ee93dc11726a58c8a5dedb. Thank you for reporting that.
To use master branch, you may need to write:
gem 'haml', git: 'https://github.com/haml/haml'
Worked now. Thanks
Most helpful comment
Would it be possible to cut a release with this fix? We're hoping to do Rails 5.1 RC1 this week and would be lovely if people using both could avoid this. Thanks!