code: def create
        @post = PostDefinition.new(post_definition_params)
        @post.user_id = current_user.id
  
        if PostDefinition.where(name: @post[:name]).blank?
          if @post.save
            @field = PostField.new(name: 'Title', field_type: 'text',
                                   required: true, post_definition_id: @post.id,
                                   user_id: current_user.id)
            if @field.save
              create_post_event
              redirect_to edit_post_definition_path(@post.id)
            end
          else
            render :new
          end
        else
          @post.errors.add(:name, ' Post Type already exist')
          render :new
        end
      end
docs: rubocop:disable all