Im creating a facebook clone using rails but i am stuck with the profile page not showing the Statuses and the content. This is the Code file:
Apps/Controller/profiles_controller.rb
class ProfilesController < ApplicationController
def show
@user = User.find_by_profile_name(params[:id])
if @user
@statuses = @user.statuses.all
render action: :show
else
render file: 'public/404' , status: 404 , formats: [:html]
end
end
end
Apps/views/profiles/show.html.erb
<%if @statuses%>
<% @statuses.each do |status| %>
<%= status.content %>
<% end %>
<% end %>
Aucun commentaire:
Enregistrer un commentaire