Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKris Chery
935 PointsUninitialized constant written shows up when I have to go the profile page. Rails 4.2.4
I can't seem to accept that page by the user_id number or by the profile name
Profile controller
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
show.html.erb
<div class="page-header">
<h1><%= @user.full_name %></h1>
</div>
<% if @statuses %>
<% @statuses.each do |status| %>
<div class="well">
<%= status.content %>
<hr />
<%= link_to time_ago_in_words(status.created_at), status_path(status) %> ago
</div>
<% end %>
<% end %>
User model page
class User < ActiveRecord::Base
has_many :statuses
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
validates :first_name, presence: true
validates :last_name, presence: true
validates :profile_name, presence: true, uniqueness: true
def full_name
full_name = "#{first_name} #{last_name}"
end
end
Kris Chery
935 PointsNot quite, I have run into some new issues with it. I have started working on my own app in hope that i figure where i went wrong.
Steve Hunter
57,712 PointsOK - cool. If you want me to have a look at the Treebook code, just link me to the Github report and I'll take a look.
Steve.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsDid you get this fixed?