Sha256: eaed304bd79269924ca934b9f8fccabf94c975a904059ab309b2bc9fd7cc9c07

Contents?: true

Size: 1019 Bytes

Versions: 8

Compression:

Stored size: 1019 Bytes

Contents

class Usher
  module Util
    class Rails
      
      def self.activate
        rails_version = "#{::Rails::VERSION::MAJOR}.#{::Rails::VERSION::MINOR}"

        case rails_version
        when '2.3'
          ActionController::Routing.module_eval "remove_const(:Routes); Routes = Usher::Interface.for(:rails23)"

        when '2.2'
          class Usher::Interface::Rails22::Mapper
            include ActionController::Resources
          end
          ActionController::Routing.module_eval "remove_const(:Routes); Routes = Usher::Interface.for(:rails22)"

        when '2.0'
          class Usher::Interface::Rails20::Mapper
            include ActionController::Resources
          end

          ActionController::Routing.module_eval <<-CODE
            remove_const(:Routes);
            interface = Usher::Interface.for(:rails20);
            interface.configuration_file = File.join(RAILS_ROOT, 'config', 'routes.rb')
            Routes = interface;
          CODE
        end
      end
      
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
usher-0.8.0 lib/usher/util/rails.rb
usher-0.7.5 lib/usher/util/rails.rb
usher-0.7.4 lib/usher/util/rails.rb
usher-0.7.3 lib/usher/util/rails.rb
usher-0.7.2 lib/usher/util/rails.rb
usher-0.7.1 lib/usher/util/rails.rb
usher-0.7.0 lib/usher/util/rails.rb
usher-0.6.8 lib/usher/util/rails.rb