polymer-rails: undefined method `context_class` with new versions of sass/sprockets

Error

/home/frexuz/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/polymer-rails-1.1.0/lib/polymer-rails/
railtie.rb:7:in `block in <class:Railtie>': undefined method `context_class' for nil:NilClass (NoMethodError)

Gemfile

source 'http://rubygems.org'
source 'http://gems.github.com/'

gem 'rails', '4.2.4'
gem 'polymer-rails'

#truncated...

group :assets do
  gem 'sass', '3.4.18'
  gem 'sass-rails', '~> 5.0.4'
  gem 'sprockets', '3.3.4'
  gem 'sprockets-rails', '3.0.0.beta2', :require => 'sprockets/railtie'
end

What’s going on? 😕

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

Leaving my solution here. In the gem file I removed sprockets gem, leaving only sprockets-rails and with this order.

gem 'sass-rails', '~> 5.0'
gem 'sprockets-rails'

On config/assets updated context_class lines to

config.assets.configure do |env|
  env.context_class.class_eval do
    # in my case I included....
    include Rails.application.routes.url_helpers
    include ActionView::Helpers
  end
end