Removing Rails from the list of administrators without removing them from the real blog

I apologize if this has already been asked, but I looked at the entire stackoverflow stack and sent it to Google.

I am creating a rails application that takes the concept of a “simple blog” from most rail manuals and adds an admin panel that decides if messages are really sent to the main site. The problem I am facing is that there are hundreds of messages and all of them are displayed in the admin panel. All options for removing them from the panel also remove them from the site.

Is it possible to delete blog posts on the administrator’s site, because they are published without deleting them from the main site, or is it better to just support them? I would suggest that this will cause speed problems when there are thousands of them.

+4
source share
2 answers

This may help you in your problem:

Note. Add an additional field as the “status” in the message table, where you are actually saving entries.

  • A post is being created from my blog, and suppose its status is Pending.

  • In my admin, I only show pending messages

  • Now from the admin panel, when I click the approve button, I will change the status of the message from "Waiting" to "Published"

  • That's all, your problem is solved.

    • messages are not deleted

    • You have a lot of messages

0
source

RailsAdmin . :

, UnpublishedBlog

class UnpublishedBlog < ActiveRecord::Base
  self.set_table_name "articles"

  default_scope where(:published => false)

  def destroy
    update_attribute(:published, true)
  end
end

, , , .

Blog RailsAdmin, .

0

Source: https://habr.com/ru/post/1527423/


All Articles