File tree 3 files changed +9
-6
lines changed
3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ class Post < ApplicationRecord
17
17
18
18
scope :for_current_user , -> ( current_user ) {
19
19
order ( created_at : :desc )
20
- . includes ( :rich_text_content , :user )
21
- . where ( user : current_user )
20
+ . includes ( :rich_text_content , :author )
21
+ . where ( author : current_user )
22
22
}
23
23
24
24
validates :slug , uniqueness : true
Original file line number Diff line number Diff line change 1
1
< h2 class ="fs-4 "> My Posts</ h2 >
2
- <%= render "posts" , posts : @posts %>
2
+
3
+ < div id ="posts ">
4
+ <%= render @posts %>
5
+ </ div >
Original file line number Diff line number Diff line change 1
- <%= content_for(:title, "AuthPost | #{@post.user .username} - #{@post.title}") %>
1
+ <%= content_for(:title, "AuthPost | #{@post.author .username} - #{@post.title}") %>
2
2
<div class ="m-auto ">
3
3
< div class ="mb-2 d-flex gap-2 flex-wrap ">
4
4
<%= link_to "Back to posts" , posts_path , class : "btn btn-secondary" %>
5
- <% if user_signed_in? && current_user == @post . user %>
5
+ <% if user_signed_in? && current_user == @post . author %>
6
6
<%= link_to "Edit" , edit_post_path ( @post ) , class : "btn btn-info" %>
7
7
<% end %>
8
- <% if user_signed_in? && current_user == @post . user %>
8
+ <% if user_signed_in? && current_user == @post . author %>
9
9
<%= link_to "Delete" ,
10
10
@post ,
11
11
data : {
You can’t perform that action at this time.
0 commit comments