Use ActiveRecord#toggle! Instead of defining a new one

[ci skip]
parent 89ca576e
......@@ -44,7 +44,7 @@ class Admin::GeoNodesController < Admin::ApplicationController
if @node.primary?
flash[:alert] = "Primary node can't be disabled."
else
@node.toggle!
@node.toggle!(:enabled)
new_status = @node.enabled? ? 'enabled' : 'disabled'
flash[:notice] = "Node #{@node.url} was successfully #{new_status}."
......
......@@ -39,10 +39,6 @@ class GeoNode < ActiveRecord::Base
!primary
end
def toggle!
update_attribute(:enabled, !enabled)
end
def uri
if relative_url_root
relative_url = relative_url_root.starts_with?('/') ? relative_url_root : "/#{relative_url_root}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment