I need create a link to `users/id/microposts` where `id` is the user id. I was wondering how I could do that with `link_to`?

The HTML code is I am using for the moment is :

```
<strong><a href="/users/<%= @user.id %>/microposts">Microposts</a></strong> <%= user.microposts.count %>

```

Which renders the following :

```
<a href="/users/1/microposts">Microposts</a>

```
['https://Stackoverflow.com/questions/9450204', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1146764/']
Python uses dictionaries to keep local and global variables in. When looking up a variable reference, it will look into the local dict first. If you want to reference a variable in the global dictionary, put the global keyword in front of it.

Also see answers to [this](https://stackoverflow.com/questions/370357/python-variable-scope-question) question for more elaborate info.
I agree with user18044, however, is your confusion about the ’f(f)’? I agree that can be really confusing, especially in a non typed language. The argument to ’f’ is a function handle that has a local type scope with name ’f’. The way python decides which ’f’ gets used is explained by 18044. Python looks at the name ’f’ on the function definition and the local parameter ’f’ takes precidence over the global name ’f’ just like would be done if we had a global variable ’dude’ and a local variable ’dude’ in a function. The local overrides the global. Hopes this helps, and makes sense. :-)