質問編集履歴
3
comment修正
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -56,7 +56,7 @@ | |
| 56 56 | 
             
              def show
         | 
| 57 57 | 
             
                @post = Post.find(params[:id])
         | 
| 58 58 | 
             
                @comment = Comment.new
         | 
| 59 | 
            -
                @ | 
| 59 | 
            +
                @comments = @post.comments
         | 
| 60 60 |  | 
| 61 61 | 
             
              end
         | 
| 62 62 |  | 
2
postに修正
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -93,7 +93,7 @@ | |
| 93 93 | 
             
              belongs_to :user
         | 
| 94 94 | 
             
              has_one_attached :image
         | 
| 95 95 | 
             
              belongs_to :season
         | 
| 96 | 
            -
              has_many : | 
| 96 | 
            +
              has_many :comment
         | 
| 97 97 | 
             
              with_options presence: true do
         | 
| 98 98 | 
             
                validates :tops
         | 
| 99 99 | 
             
                validates :pants
         | 
1
post.rbの追記
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -86,4 +86,23 @@ | |
| 86 86 | 
             
                params.require(:comment).permit(:text).merge(user_id: current_user.id, post_id: params[:post_id])
         | 
| 87 87 | 
             
              end
         | 
| 88 88 | 
             
            end
         | 
| 89 | 
            +
            ```
         | 
| 90 | 
            +
            ```post
         | 
| 91 | 
            +
            class Post < ApplicationRecord
         | 
| 92 | 
            +
              extend ActiveHash::Associations::ActiveRecordExtensions
         | 
| 93 | 
            +
              belongs_to :user
         | 
| 94 | 
            +
              has_one_attached :image
         | 
| 95 | 
            +
              belongs_to :season
         | 
| 96 | 
            +
              has_many :Comment
         | 
| 97 | 
            +
              with_options presence: true do
         | 
| 98 | 
            +
                validates :tops
         | 
| 99 | 
            +
                validates :pants
         | 
| 100 | 
            +
                validates :shoes
         | 
| 101 | 
            +
                validates :season_id
         | 
| 102 | 
            +
                validates :image
         | 
| 103 | 
            +
                validates :season_id, numericality: { other_than: 1 } 
         | 
| 104 | 
            +
              end
         | 
| 105 | 
            +
            end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
            ```
         | 
| 89 | 
            -
             | 
| 108 | 
            +
            
         | 
