-
Notifications
You must be signed in to change notification settings - Fork 333
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
undefined method asset_environment' for class
Sprockets::Railtie' (NameError)
#22
Comments
Reproduction instructions (with latest rails 3-1-stable):
Full scenario and captured output: http://intertwingly.net/projects/AWDwR4/checkdepot-192-31/section-2.html |
git bisect output:
Note: markdown is being too helpful here. Correct link for the commit is as follows: |
Should be able to move that monkey patch into the railtie initializer: initializer :setup_sass do |app|
# ...
app.assets.context_class.extend(Sass::Rails::SassContext)
app.assets.context_class.sass_config = app.config.sass
end |
same issue here with rails-3-1-stable & sass-rails-3.1.0.rc.5 |
I can verify that the following works on rails master: module Sass::Rails::SassContext
attr_accessor :sass_config
end
begin
# Before sprockets was extracted from rails
require 'sprockets/railtie'
module Sprockets
class Railtie < ::Rails::Railtie
initializer :setup_sass do |app|
app.assets.context_class.extend(Sass::Rails::SassContext)
app.assets.context_class.sass_config = app.config.sass
end
end
end
rescue LoadError
# After sprockets was extracted into sprockets-rails
require 'sprockets/rails/railtie'
module Sprockets
module Rails
class Railtie < ::Rails::Railtie
include Sass::Rails::SprocketsConfig
end
end
end
end Note that I only added the code that Josh provided to the Before sprockets was extracted from rails code path as that is the path used with the Rails master. |
I've now verified that the same code works with 3-1-stable. As sass-rails versions are tightly coupled with Rails versions, I suggest that the |
sass-rails can add a requirement for |
Some new commits on https://github.com/rails/sass-rails/commits/3-1-stable please let me know if there's any other issue so I can release. |
Fixed the one in the issue, but created another one:
|
grrr. can someone see if they can fix this? I'm at work now. |
Wow, github really surprised me with referencing this. |
@grk can you provide a failing test case with it? |
8 specs fail without it. |
I've tested @chriseppstein changes on both 3-1-stable and master, and they work for me. I've tried @grk's version, and oddly my test is failing once I turn on:
I'm going to try further tests to verify that this was caused by grk's changes and is not unrelated. |
That fix doesn't do anything. Its as good as commenting out that code. |
assuming this fixes the problem, can you add it to the 3-1-stable branch? |
are you testing in both production and development modes? My assumption is yes but my trivial app runs in production but not in development with this mornings code. |
I'm still getting
|
@josh's commit fixes it but it's not part of the 3-1-stable branch yet... |
Ah, yes. I somehow kept thinking that 3-1-stable was the working branch. But you're right, that |
Pushed to 3-1-stable |
I'm still getting |
@huerlisi steps to reproduce it? did you run bundle update before? just checking because shouldn't be an issue anymore. |
@spastorino did not run This is with ruby 1.8.7 |
Same after a See log of commands and output at https://gist.github.com/1122050 |
@huerlisi It's working perfect for me but the way I'm able to test sass-rails it's odd. I have cloned sprockets and sass and done this https://gist.github.com/93866fc6403d40d67d0d Results of the tests for me ...
Can you try doing the same? /cc @chriseppstein it's there a better way to test sass-rails? just cloning sass-rails and running the tests I get the same results @huerlisi is getting |
@huerlisi use 3-1-stable branch of Rails, and master of sprockets and sass |
@trapni have you tested with the steps I've provided?, can you provide info on what's wrong? |
Same issue here.
Adding 3-1stable branch to sass-rails fixes the error:
But now, I'm getting the same issue than @johnnym:
|
@mariozaizar, the gem setup below is working for me (aside from a new issue in compass/blueprint).
I forgot to mention... you should also |
@johnlauck, Thanks but that didn't work.. But, now I can confirm that doing the monkey patch from:
Totally works for |
I've fixed Otherwise |
@thedarkone, why is it that you've got sass-rails install but the asset-pipeline disabled... This seems like a strange use case to me. |
I'm trying to upgrade sass and compass (to their current masters) in my 3.1 app, I'm not comfortable with asset-pipeline yet and I have compass's |
I see the same issue as @mariozaizar In my case, it is caused by line 47 in template_handlers.rb, in the sass_options_from_rails method i.e. scope.environment.context_class.sass_config I do not understand enough about Rails internals to know why the context_class does not have a sass_config method since the one used in railtie.rb does. It would appear that the context_class in railtie.rb can not the same one used in this method. |
Hi guys,
Cheers! |
Mario, Thanks for posting that. I changes my Gemfile from
to use rc5 from github exactly as you do. And the problem went away. Which suggests there must be some difference between the "regular" gem and github? |
How can I get this working with gem 'rails', '3.1.0.rc5'? I can't use gem 'rails', '3.1.0.rc5', :git => "git://github.com/rails/rails", :branch => "3-1-stable" on heroku, it just bloats my slug size far too much. I also get "undefined method `context_class' for nil:NilClass (NoMethodError)" |
Okay, as a first solution I removed the sass-rails gem - don't need it yet. ;-) Now it works. |
My asset pipeline is enabled, yes. |
I have the same problem, and the only way to fix it is the same as @ncri: Remove the sass-rails gem :( |
I bumped to sass-rails from git and seems to work fine now. |
It turned out that I forgot to install Node.js and Coffescript (how stupid!) on the server. Installing them, and then reinstalling the last version of sass-rails, solved the problem. YAY! |
Yep, all works for me too now with rails rc6. I was able to add the sass-rails gem again. |
fixed by 74c5e4e. Sass rails will raise an error if the asset pipeline is not enabled -- in these cases the sass-rails plugin should not be used/activated. |
I am getting the same error mentioned many times in above discussions |
@PrajktaP do you use rails 3.1 rc6? |
No, its rails 3.1 rc4 |
try upgrading |
I have upgraded to rc6. Now I am getting following error |
Yes, then just do it. :) I'm surprised though you didnt get that error with rc4. |
Thanks for all you responses. |
What do I do with this? rake aborted! |
Has it to do anything with my ruby version? I am using 1.8.7 |
Stack trace:
The text was updated successfully, but these errors were encountered: