How does Rails 2.2 process a requested url?

What's the call stack Rails runs through when processing an incomi

Page 1 of 1

0 Replies - 1712 Views - Last Post: 29 March 2009 - 12:41 PM Rate Topic: -----

#1 wantar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 25-March 09

How does Rails 2.2 process a requested url?

Posted 29 March 2009 - 12:41 PM

Ok, so my issue is this: I have a project I'm working on here that uses a new url spec I'm working on. without going into to much detail, if a request comes in for the following url GET photos(name,thumbnail) it would be routed to the PhotosController.read method. This works properly when the call is made from an AJAX request.

My problem is that I'm trying to write functional tests to validate this functionality but nothing is working. I've looked all over the web and read lots of blog posts, but I can't find anything covering the new way Rails does routing. I've tried:

Routes.named_routes[:read].recognize(path, env)


All I get back is null - and I can't find documentation for the recognize method anywhere.

The code in my test is shown below:

require 'test/helper'
ActionController::Routing::Routes = Caesar::Query::Set.new
ActionController::Routing::RouteSet::Mapper.send :include, Caesar::Live

class LiveQueriesTest < Test::Unit::TestCase #:nodoc:

def setup
	ActionController::Routing::Routes.draw do |map|
	  map.queries
	end
  end
  
  def test_live_queries
	puts ActionController::Routing:Routes.named_routes[:read].recognize('photos(name,thumbnail)', :action => 'read', :qualifiers => 'ssid/:ssid', :method => :get)
  end
end


The puts call displays nil. Any help would be greatly appreciated.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1