Created
November 3, 2015 03:07
-
-
Save Frank004/91fd606ac87ef178ebbd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
En el article block pones una de estas | |
<%= link_to article.user.name, user_path(article.user_id) %> | |
or | |
<%= link_to article.user.name, user_path(article.user.id) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devise_for :users | |
resources :users, only: [:show, :index] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersController < ApplicationController] | |
before_action :set_user, only:[:show] | |
def show | |
end | |
private | |
def set_user | |
@user = User.find_by(username: params[:id]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment