Home>

I wrote the destroy method in the controller

def destroy
    binding.irb
    @twit= load_twit
    @twit.destroy
    redirect_to tweets_path
  end

After that, in views in show, I added a button that performs the corresponding action

<%= link_to "Destroy", twit_path(@twit), :class=>'btn btn-danger', method: :delete, data: { confirm: 'Are you sure?'} %>

However, when I try to delete a post, nothing happens. I also tried to create a new post in the console and delete it, but the situation is the same

That is, after deletion, you are looking for a tweet with such an ID in the console, and is it located? And there are no errors while doing this? In the model, the destroy method is not overridden, by any chance?

Василиса2022-02-08 15:42:13

adding turbo-method helped.

Yeahwheel2022-02-08 15:42:13

Well, yes, the 7th rails are such rails ...

Василиса2022-02-08 15:42:13

I figured out the removal, but the comments are not added. checked through binding.pry, the build method works, but the comments are not displayed. how can i fix it?

Yeahwheel2022-02-08 15:42:13

Create a new question, add the appropriate controller and view code and all the details of the problem to it

Василиса2022-02-08 15:42:13