# Method url

**URL:** <https://www.ruby-forum.com/t/method-url/187871>\
**Category:** Rails\
**Created:** [April 30, 2010, 6:51pm UTC](https://www.ruby-forum.com/t/method-url/187871 "2010-04-30T18:51:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@kevid](https://www.ruby-forum.com/u/kevid)\
**Post date:** [April 30, 2010, 6:51pm UTC](https://www.ruby-forum.com/t/method-url/187871/1 "2010-04-30T18:51:39Z")

</div>

Hi all,

Does anyone knows how to access a method’s url within the method

for instance;

## def index

–  
– #some code that will append a parameter to the url that will call  
the show method.  
show  
end

def show  
url = (show method’s url with the appended parameter )  
puts url # =\> [http://localhost:8080/app/Input/show?cv=xxxxxxxxxx](http://localhost:8080/app/Input/show?cv=xxxxxxxxxx)  
end

The idea is to be able to access the appended parameter within the  
show method.

…will appreciate any idea.

---

<div class="post-metadata">

**Author:** ![kevid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@kevid](https://www.ruby-forum.com/u/kevid)\
**Post date:** [April 30, 2010, 6:56pm UTC](https://www.ruby-forum.com/t/method-url/187871/2 "2010-04-30T18:56:55Z")

</div>

On Fri, Apr 30, 2010 at 9:50 AM, kevid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> def show  
> url = (show method’s url with the appended parameter )  
> puts url # =\> [http://localhost:8080/app/Input/show?cv=xxxxxxxxxx](http://localhost:8080/app/Input/show?cv=xxxxxxxxxx)

puts request.url

> end

## BTW, the API docs are your friend 🙂

Hassan S. ------------------------ removed\_email\_address@domain.invalid  
twitter: @hassan
