Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to Haml::Plugin for Rails 6 #1008

Merged
merged 1 commit into from Mar 15, 2019

Conversation

sebjacobs
Copy link
Contributor

In Rails 6 the API for template handlers is changing, a template handler
must now take two arguments [1], the template and the source, otherwise you
will see the following deprecation warning:

ActiveSupport::DeprecationException: DEPRECATION WARNING: Single arity
template handlers are deprecated.  Template handlers must now accept two
parameters, the view object and the source for the view object.
Change:
  >> Class#call(template)
To:
  >> Class#call(template, source)

I have attempted to retain support for older versions of Rails by
providing a default source of nil.

[1] https://www.github.com/rails/rails/commit/28f88e0074

In Rails 6 the API for template handlers is changing, a template handler
must now take two arguments [1], the template and the source, otherwise you
will see the following deprecation warning:

```
ActiveSupport::DeprecationException: DEPRECATION WARNING: Single arity
template handlers are deprecated.  Template handlers must now accept two
parameters, the view object and the source for the view object.
Change:
  >> Class#call(template)
To:
  >> Class#call(template, source)
```

I have attempted to retain support for older versions of Rails by
providing a default source of `nil`.

[1] https://www.github.com/rails/rails/commit/28f88e0074
@amatsuda
Copy link
Member

Yeah, I know this would be the workaround for the currently released Rails 6 beta gems, but I'm not sure whether Aaron's "refactoring" has been all done or still ongoing...

So for now, let's just merge this and wait until another stabler Rails release.

@sebjacobs Thank you for the patch anyway!

@morgoth
Copy link

morgoth commented May 10, 2019

@amatsuda Rails 6 is around the corner ;-) - can we have this released?

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Mar 24, 2020
Update ruby-haml to 5.1.2.
pkgsrc change: add "USE_LANGUAGES=	# none".


## 5.1.2

Released on August 6, 2019
([diff](haml/haml@v5.1.1...v5.1.2)).

* Fix crash in some environments such as New Relic by unfreezing string literals for ParseNode#inspect. [#1016](haml/haml#1016) (thanks [Jalyna](https://github.com/jalyna))

## 5.1.1

Released on May 25, 2019
([diff](haml/haml@v5.1.0...v5.1.1)).

* Fix NameError bug for that happens on ruby 2.6.1-2.6.3 + haml 5.1.0 + rails 4.2.x + erubi. (Akira Matsuda)

## 5.1.0

Released on May 16, 2019
([diff](haml/haml@v5.0.4...v5.1.0)).

* Rails 6 support [#1008](haml/haml#1008) (thanks [Seb Jacobs](https://github.com/sebjacobs))
* Add `escape_filter_interpolations` option for backwards compatibility with haml 4 defaults [#984](haml/haml#984) (thanks [Will Jordan](https://github.com/wjordan))
* Fix error on empty :javascript and :css filter blocks [#986](haml/haml#986) (thanks [Will Jordan](https://github.com/wjordan))
* Respect changes in Haml::Options.defaults in `Haml::TempleEngine` options (Takashi Kokubun)
* Un-freeze TempleEngine precompiled string literals [#983](haml/haml#983) (thanks [Will Jordan](https://github.com/wjordan))
* Various performance/memory improvements [#965](haml/haml#965), [#966](haml/haml#966), [#963](haml/haml#963) (thanks [Dillon Welch](https://github.com/oniofchaos))
* Enable `frozen_string_literal` magic comment for all .rb files [#967](haml/haml#967) (thanks [Dillon Welch](https://github.com/oniofchaos))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants