Sha256: e194172cd0b561ecf78856a9aec6ffe92285200d305e523aa95b1711029e7151

Contents?: true

Size: 995 Bytes

Versions: 163

Compression:

Stored size: 995 Bytes

Contents

module ActionDispatch
  module Routing
    class RoutesProxy #:nodoc:
      include ActionDispatch::Routing::UrlFor

      attr_accessor :scope, :routes
      alias :_routes :routes

      def initialize(routes, scope)
        @routes, @scope = routes, scope
      end

      def url_options
        scope.send(:_with_routes, routes) do
          scope.url_options
        end
      end

      def respond_to?(method, include_private = false)
        super || routes.url_helpers.respond_to?(method)
      end

      def method_missing(method, *args)
        if routes.url_helpers.respond_to?(method)
          self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
            def #{method}(*args)
              options = args.extract_options!
              args << url_options.merge((options || {}).symbolize_keys)
              routes.url_helpers.#{method}(*args)
            end
          RUBY
          send(method, *args)
        else
          super
        end
      end
    end
  end
end

Version data entries

163 entries across 124 versions & 18 rubygems

Version Path
actionpack-3.2.14.rc1 lib/action_dispatch/routing/routes_proxy.rb
swipe-rails-0.0.5 vendor/bundle/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/routes_proxy.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/routes_proxy.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/routes_proxy.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/routes_proxy.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/routes_proxy.rb
font-awesome-rails-3.1.1.2 vendor/ruby/2.0.0/gems/actionpack-3.2.12/lib/action_dispatch/routing/routes_proxy.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/routes_proxy.rb
font-awesome-rails-3.1.1.1 vendor/ruby/2.0.0/gems/actionpack-3.2.12/lib/action_dispatch/routing/routes_proxy.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb
challah-1.0.0.beta3 vendor/bundle/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb
challah-1.0.0.beta2 vendor/bundle/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb
challah-1.0.0.beta vendor/bundle/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb
challah-1.0.0.beta vendor/bundle/gems/actionpack-3.2.11/lib/action_dispatch/routing/routes_proxy.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/routes_proxy.rb