So I want to display posts for an user in his/her profile page as at top user details, below all the posts.

I know I can get param from a url like **<http://localhost:3000/posts?category=article>**

with 

```
if params[:category]
  @category_id = Category.find_by(title: params[:category]).id
  @posts = Post.where(category_id: @category_id)
end

```

---

but param doesn't work when I have an url like **<http://localhost:3000/user/adem-balka>**

**So, how can I get user name to find its id and pull posts with that user id?**

Thank you all.