spec/db/models.rb in closure_tree-5.2.0 vs spec/db/models.rb in closure_tree-6.0.0.alpha
- old
+ new
@@ -1,11 +1,8 @@
-require 'uuidtools'
-
class Tag < ActiveRecord::Base
has_closure_tree :dependent => :destroy, :order => :name
before_destroy :add_destroyed_tag
- attr_accessible :name, :title if _ct.use_attr_accessible?
def to_s
name
end
@@ -18,14 +15,13 @@
class UUIDTag < ActiveRecord::Base
self.primary_key = :uuid
before_create :set_uuid
has_closure_tree dependent: :destroy, order: 'name', parent_column_name: 'parent_uuid'
before_destroy :add_destroyed_tag
- attr_accessible :name, :title if _ct.use_attr_accessible?
def set_uuid
- self.uuid = UUIDTools::UUID.timestamp_create.to_s
+ self.uuid = SecureRandom.uuid
end
def to_s
name
end
@@ -35,11 +31,10 @@
DestroyedTag.create(:name => name)
end
end
class DestroyedTag < ActiveRecord::Base
- attr_accessible :name if Tag._ct.use_attr_accessible?
end
class User < ActiveRecord::Base
acts_as_tree :parent_column_name => "referrer_id",
:name_column => 'email',
@@ -50,12 +45,10 @@
def indirect_contracts
Contract.where(:user_id => descendant_ids)
end
- attr_accessible :email, :referrer if _ct.use_attr_accessible?
-
def to_s
email
end
end
@@ -67,12 +60,10 @@
# make sure order doesn't matter
acts_as_tree :order => :column_whereby_ordering_is_inferred, # <- symbol, and not "sort_order"
:parent_column_name => "mother_id",
:dependent => :destroy
- attr_accessible :name if _ct.use_attr_accessible?
-
def to_s
"#{self.class}: #{name}"
end
end
@@ -93,10 +84,9 @@
def self.table_name_prefix
'namespace_'
end
class Type < ActiveRecord::Base
has_closure_tree dependent: :destroy
- attr_accessible :name if _ct.use_attr_accessible?
end
end
class Metal < ActiveRecord::Base
self.table_name = "#{table_name_prefix}metal#{table_name_suffix}"