Device authentication and a separate controller (Users), which is a single “show” action
class UsersController < ApplicationController
While in the view (users / show.html.erb) only the username of the available profile is displayed
<%= @user.username %>
Routing also:
resources :users
I would like these profile pages to be publicly accessible if they get a link to it / say the address, but also want the accessible link for the current user to be available to visit his profile. My snippet from my header:
<li><%= link_to "Profile", @user %></li> <li><%= link_to "Settings", edit_user_registration_path %></li> <li><%= link_to "Logout", destroy_user_session_path, method: "delete" %></li>
@User is currently here to stop a routing error. I'm not quite sure what to refer to, I tried quite a few combinations, but, obviously, my newcomer to rails is missing something more that I need to do. Any help is much appreciated!
(Rails 4, ruby 2.0.0)
Side note. I would also like to ultimately allow the link to the profile page to display id + username in the format: # {id} - # {username} (instead of being user / 1 → users / 1-bbvoncrumb).
ruby-on-rails ruby-on-rails-4 devise
bvcm
source share