Ideally I want some like this LastName, FirstName, how to put comma into the link ?
<%= link_to @name.first.LastName,@name.first.FirstName, management_show_path(:user_id => @name.first.id) %>
Ideally I want some like this LastName, FirstName, how to put comma into the link ?
<%= link_to @name.first.LastName,@name.first.FirstName, management_show_path(:user_id => @name.first.id) %>
<%= link_to @name.first.LastName+ ','+ @name.first.FirstName, management_show_path(:user_id => @name.first.id) %>
Like this:
<%= link_to "#{@name.first.LastName}, #{@name.first.FirstName}", management_show_path(:user_id => @name.first.id) %>
I'd use a helper method. Something like:
def user_name(user)
[user.last_name, user.first_name].join ", "
end
and call it via:
<%= link_to user_name(@user), management_show_path(user_id: @user.id) %>