haml / haml-rails

let your Gemfile do the talking
MIT License
1.04k stars 169 forks source link

Using :erb filter multiple times repeats all previous :erb filter content. #161

Open fleitz opened 5 years ago

fleitz commented 5 years ago
%h1 Foos
:erb
  <%= "test" %>
:erb
  <%= "test" %>

Expected Result: test is printed twice.

Actual Result: test is printed three times.

The more times you use the ERB filter the more times it repeats all previous :erb filter content.

Running this view through haml on the command line produces the intended result, so I believe this is an issue with the way haml interacts with rails.

Produced this result by using only rails new rails_test and then adding the haml-rails and haml gems to the Gemfile and scaffolding a foos_controller.

From Gemfile.lock:

haml (5.1.1)
  temple (>= 0.8.0)
  tilt
haml-rails (1.0.0)
  actionpack (>= 4.0.1)
  activesupport (>= 4.0.1)
  haml (>= 4.0.6, < 6.0)
  html2haml (>= 1.0.1)
  railties (>= 4.0.1)

rails (5.2.3)
  actioncable (= 5.2.3)
  actionmailer (= 5.2.3)
  actionpack (= 5.2.3)
  actionview (= 5.2.3)
  activejob (= 5.2.3)
  activemodel (= 5.2.3)
  activerecord (= 5.2.3)
  activestorage (= 5.2.3)
  activesupport (= 5.2.3)
fleitz commented 5 years ago

https://github.com/fleitz/erb_filter_dupes