School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,436 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,472 people online right now. Registration is fast and FREE... Join Now!




How does Rails 2.2 process a requested url?

 

How does Rails 2.2 process a requested url?, What's the call stack Rails runs through when processing an incomi

wantar

29 Mar, 2009 - 11:41 AM
Post #1

New D.I.C Head
*

Joined: 25 Mar, 2009
Posts: 1


My Contributions
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:

CODE
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:

CODE
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.

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 12:57AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month