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 version checking logic wrong in rails.rb #466

Closed
betelgeuse opened this issue Aug 1, 2012 · 5 comments
Closed

rails version checking logic wrong in rails.rb #466

betelgeuse opened this issue Aug 1, 2012 · 5 comments
Labels
bug Something isn't working

Comments

@betelgeuse
Copy link

In lib/sass/plugin/rails.rb we have the following code

  # Rails 3.1 loads and handles Sass all on its own
  if defined?(ActionController::Metal)
    #3.1 > Rails >= 3.0
    require 'sass/plugin/rack'
    Rails.configuration.middleware.use(Sass::Plugin::Rack)
  elsif defined?(ActionController::Dispatcher) &&
      defined?(ActionController::Dispatcher.middleware)
    # Rails >= 2.3
    require 'sass/plugin/rack'
    ActionController::Dispatcher.middleware.use(Sass::Plugin::Rack)
  else
    module ActionController
      class Base
        alias_method :sass_old_process, :process
        def process(*args)
          Sass::Plugin.check_for_updates
          sass_old_process(*args)
        end
      end
    end
  end

In rails console for 3.1:

1.9.3p125 :002 > defined?(ActionController::Metal)
 => "constant"

This means that sass will run code where the comments claim to be for 3.0.x also on 3.1. Can someone knowing the history explain what the goal here is? I am thinking that if asset pipeline is enabled we don't want to load the plugin.

@nex3
Copy link
Contributor

nex3 commented Aug 3, 2012

sass/plugin is typically not required at all in a Rails 3.1+ project, I believe.

@chriseppstein
Copy link

@nex3 it's possible to disable the asset pipeline and use the Sass::Plugin instead. Sass::Plugin can check whether the asset pipeline is enabled. In compass-rails we use this to check:

(cfg = Rails.application.config) && cfg.respond_to?(:assets) && cfg.assets.try(:enabled)

@nex3
Copy link
Contributor

nex3 commented Aug 11, 2012

But why would sass/plugin be loaded in the first place if the user wants to use the asset pipeline?

@chriseppstein
Copy link

@nex3 Isn't it the default behavior?

@nex3
Copy link
Contributor

nex3 commented Aug 15, 2012

No, I believe sass/plugin is not loaded at all in Rails >= 3.1.

@nex3 nex3 closed this as completed Feb 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants