Display data by ID


#1

i Wand to display user details for client view.

I get the user details by Id and display the details. but it show errors.

i mention below the code details and error image.

index page…
<tbody>

<% @consultant.each do |consultant| %>

<tr>

<td><%=link_to consultant.f_name , clients_consultantprofile_path(consultant_id: consultant), remote: true, method: :post%>

<%= consultant.l_name %></td>

<td><%= consultant.company_name %></td>

<td><%= consultant.job_title %></td>

<td><%= consultant.skill %></td>

<td><%= consultant.year_ex %></td>

<td><%# link_to ‘View’, clients_consultantprofile_path(consultant.id) %></td>

</tr>

<% end %>

view page…
<% @consultant.each do |consultant| %>

<div class='row'>
  <h1 class='clearfix m-l-20'>Personal Details</h1>
  <div class='col-xs-4'>
    <div class="field ">
      <div class='col-xs-6'>
        <strong>Name:</strong>
      </div>
      <div class='col-xs-6'>
        <%= consultant.f_name %>
        <%= consultant.l_name %>
      </div>        
    </div>

    <div class="field ">
      <div class='col-xs-6'>
        <strong>Email:</strong>
      </div>
      <div class='col-xs-6'>
        <%= consultant.email %>
      </div>        
    </div>

In Controller…

@consultant = Consultant.find_by_id(params[:id])

it shows error like:

view%20error