newb still learning here, i'm having problems displaying the author's
login name and instead it's displaying the author's id# in mysql. i'm
currently using the acts_as_authenticated plug in which seems to be
working fine and i've assigned the posts to the authors by: @post.user =
current_user
the user login is stored as login but i have no idea how to call the
user's login field in the controller i was thinking using something like
@user = @user.login but it didn't work so i gues i'm doing something
wrong.
here is the code:
in the controller:
def show
store_location
@post = Post.find(params[:id])
end
in the view:
<span>
Posted by : <%= link_to @post.user_id -%>
<%= distance_of_time_in_words_to_now(@post.created_at) %> ago
</span>
newb still learning here, i'm having problems displaying the author's
login name and instead it's displaying the author's id# in mysql. i'm
currently using the acts_as_authenticated plug in which seems to be
working fine and i've assigned the posts to the authors by: @post.user =
current_user
the user login is stored as login but i have no idea how to call the
user's login field in the controller i was thinking using something like
@user = @user.login but it didn't work so i gues i'm doing something
wrong.
here is the code:
in the controller:
def show
store_location
@post = Post.find(params[:id])
end
in the view:
<span>
Posted by : <%= link_to @post.user_id -%>
<%= distance_of_time_in_words_to_now(@post.created_at) %> ago
</span>