Public user profiles? Ruby on Rails + Devise

后端 未结 3 1935
悲&欢浪女
悲&欢浪女 2021-02-06 19:40

How to make public user profiles? I use Devise and only have /user/. User can see only his profile, I want to make /user/user_id.

user_id - public user profile.

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 20:00

    I'm not that experienced, but I did it like this:

    • In controllers create a users_controller.rb

    • In views create /users/ typical views, for example index and show (of course define them in your controller)

    • In routes add resources :users

    You can simply add migrations to the users table, like

    $ rails g migration add_birthday_to_users birthday:date
    

    and show this on the users/:id page

提交回复
热议问题