app/models/landable/page.rb in landable-1.7.1.rc1 vs app/models/landable/page.rb in landable-1.8.0
- old
+ new
@@ -8,10 +8,11 @@
class Page < ActiveRecord::Base
include ActionView::Helpers::TagHelper
include Landable::HasAssets
include Landable::Engine.routes.url_helpers
include Landable::TableName
+ include Landable::Librarian
validates_presence_of :path, :status_code
validates_presence_of :redirect_url, if: -> page { page.redirect? }
validates_inclusion_of :status_code, in: [200, 301, 302, 410]
@@ -120,9 +121,17 @@
when 'xml'
'application/xml'
else
'text/plain'
end
+ end
+
+ def deactivate
+ self.update_attribute(:status_code, 410)
+
+ publish!(author_id: updated_by_author.id, notes: "This page has been trashed")
+
+ super
end
def html?
content_type == 'text/html'
end