What's my URL?

12 views
Skip to first unread message

Dave Howell

unread,
Jul 21, 2010, 4:59:02 AM7/21/10
to ram...@googlegroups.com
Something happened at some point, and I'm not sure what. Upgrading Ramaze, possibly, or moving my webserver to a different machine. Part of my code was trying to figure out the answer to the question "What URL did I use to get to this block of code? with

request.env["PATH_INFO"]

Unfortunately, that's now coming back empty.

As it turns out, I 'solved' this problem twice in two different ways. A different part of my code uses

action.node.r(action.path, request.params)

and that's still mostly working. But I don't know why I did that, or where I got it from. I asked the installed documentation to tell me more about 'action.' It isn't aware of that method at all. Just 'action_missing'. Google sent me (not surprisingly) to the "Journey" book. It give me a list of action's methods. "Path" is not one of the 'members' listed. "Node", according to the example, probably contains a Controller. But the Controller class doesn't have an "r" method described in the docs either.


grep grep grep read source grep grep read source


Ah, I've found it. There's a whole different block of documentation under Innate. "r" is an alias for "route." "Route," rather amusingly, has a bunch of examples that all use "r" instead of "route".

It ends with

"@return [URI] to the location"

which I'm guessing is supposed to mean

[route] returns a URI to the new location

The presence of the commercial-at sign is baffling.

Lars Olsson

unread,
Jul 21, 2010, 5:10:40 AM7/21/10
to Ramaze
Since Innate is based on Rack, can't you use the methods listed at
http://rack.rubyforge.org/doc/classes/Rack/Request.html for doing this
kind of things?

request.path
request.path_info
request.script_name
etc.

/lasso

Lars Olsson

unread,
Jul 21, 2010, 5:34:13 AM7/21/10
to Ramaze
I just threw together a quick test using a brand new project. I added
the following action to the main controller.

def simple
out = '<ul>'
%w(fullpath host host_with_port ip path path_info port
query_string referer request_method scheme script_name url
user_agent).each do |v|
out << "<li>#{v}=#{request.send(v)}</li>"
end
out << '</ul>'
out
end

I think that action will show you most info that you need. If not,
just add the appropiate methods from the web page I mentioned before.

/lasso



On 21 Juli, 10:59, Dave Howell <groups.20...@grandfenwick.net> wrote:

Dave Howell

unread,
Jul 22, 2010, 1:34:53 AM7/22/10
to ram...@googlegroups.com

On Jul 21, 2010, at 2:10 , Lars Olsson wrote:

> Since Innate is based on Rack, can't you use the methods listed at
> http://rack.rubyforge.org/doc/classes/Rack/Request.html for doing this
> kind of things?

Hmm. I have no idea.

So Innate builds on/uses Rack, and Ramaze builds on/uses Innate.

I think what I need to do is re-run RDoc, feeding it all the files from all three systems so I can all the applicable modules and methods to appear in the same place at the same time.

Are there any other components involved that I would want to include?


Lars Olsson

unread,
Jul 22, 2010, 3:23:22 AM7/22/10
to Ramaze
Yes, Ramaze::Request inherits from Innate::Request which in turn
inherits from Rack::Request.

I had the same problems finding out where things came from a while
ago, so I created a script to create merged RDocs for ramaze, innate
and rack. The script is available in the files section of this group
at http://ramaze.googlegroups.com/web/merged_rdocs.rb

/lasso



On 22 Juli, 07:34, Dave Howell <groups.20...@grandfenwick.net> wrote:
> On Jul 21, 2010, at 2:10 , Lars Olsson wrote:
>
> > Since Innate is based on Rack, can't you use the methods listed at
> >http://rack.rubyforge.org/doc/classes/Rack/Request.htmlfor doing this
Reply all
Reply to author
Forward
0 new messages