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

Rails 6 compatibility #7

Open
philippks opened this issue Oct 29, 2019 · 0 comments
Open

Rails 6 compatibility #7

philippks opened this issue Oct 29, 2019 · 0 comments

Comments

@philippks
Copy link

Unfortunately, we had this old gem in a application, which we upgraded from 5.2 to 6.0.

Due to the same issue described in rspec/rspec-rails#2086 we monkey patched coffee-views to make it work again. Feel free to implement it, if you need it.

# Monkey patch for rails 6.
# The fix was adopted from the fix by rspec.
# https://github.com/rspec/rspec-rails/issues/2086
# https://github.com/rails/rails/commit/28f88e0074f473f58c2d3fd54cb3daff81027c12#diff-562906215bf781788ec5aaf37e958cb8
# https://github.com/yury/coffee-views/blob/master/lib/coffee_views/rails.rb#L29
CoffeeViews::Rails::TemplateHandler.class_eval do
  def self.call(template)
    source = compile_coffee(template.source)
    template.instance_variable_set :@source, source

    erb_handler.call(template, _source = source)
  end
end
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

No branches or pull requests

1 participant