# Only\_path not working?

**URL:** <https://www.ruby-forum.com/t/only-path-not-working/121772>\
**Category:** Rails\
**Created:** [November 30, 2007, 7:43pm UTC](https://www.ruby-forum.com/t/only-path-not-working/121772 "2007-11-30T19:43:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jooma2](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9bcb4/32.png) [@jooma2](https://www.ruby-forum.com/u/jooma2)\
**Post date:** [November 30, 2007, 7:43pm UTC](https://www.ruby-forum.com/t/only-path-not-working/121772/1 "2007-11-30T19:43:01Z")

</div>

I’m developing a facebook app and I need url\_for to just spit out the  
relative url of my controller and action path.

From what I’ve read everywhere I just need to add the option :only\_path  
=\> true  
and that should just spit out my relative url.

But that’s not what’s happening.

Here’s an example.

\<fb:action href="\<%= url\_for :controller =\> ‘my\_controller’, :action =\>  
‘my\_action’, :only\_path =\> true -%\>"\>Show My Action\</fb:action\>

the fb stuff is just facebook markup language.

But anyway that should work, but it doesn’t, instead it’s linking right  
back to full url which is my server that it needs to call to and takes  
you out of the facebook app.

I’ve also added to my environment.rb

ActionController::AbstractRequest.relative\_url\_root="/myappname"  
RAILS\_RELATIVE\_URL\_ROOT="/myappname"

Any ideas?
