diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb new file mode 100644 index 0000000..d802715 --- /dev/null +++ b/app/controllers/profiles_controller.rb @@ -0,0 +1,5 @@ +class ProfilesController < ApplicationController + def show + @profile = Profile.find params[:id] + end +end diff --git a/app/models/profile.rb b/app/models/profile.rb index 2107e8c..33d5cc7 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -1,3 +1,7 @@ class Profile < ApplicationRecord has_many :posts + + def full_name + [first_name, last_name].map(&:presence).compact.join ' ' + end end diff --git a/app/views/profiles/show.html.erb b/app/views/profiles/show.html.erb new file mode 100644 index 0000000..ad9237e --- /dev/null +++ b/app/views/profiles/show.html.erb @@ -0,0 +1,11 @@ +
<%= @profile.description %>
+ +<% if @profile.posts.present? %> +