aunderwo-acts_as_tree 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'acts_as_tree'
3
- s.version = '1.0.3'
3
+ s.version = '1.0.4'
4
4
  s.date = '2008-10-02'
5
5
 
6
6
  s.summary = "Allows ActiveRecord Models to be easily structured as a tree"
@@ -9,7 +9,7 @@ module ActiveRecord
9
9
  # association. This requires that you have a foreign key column, which by default is called +parent_id+.
10
10
  #
11
11
  # class Category < ActiveRecord::Base
12
- # acts_as_tree :order => "name", :dependent => false
12
+ # acts_as_tree :order => "name"
13
13
  # end
14
14
  #
15
15
  # Example:
@@ -40,16 +40,11 @@ module ActiveRecord
40
40
  # * <tt>order</tt> - makes it possible to sort the children according to this SQL snippet.
41
41
  # * <tt>counter_cache</tt> - keeps a count in a +children_count+ column if set to +true+ (default: +false+).
42
42
  def acts_as_tree(options = {})
43
- configuration = { :foreign_key => "parent_id", :order => nil, :counter_cache => nil, :dependent => :destroy }
43
+ configuration = { :foreign_key => "parent_id", :order => nil, :counter_cache => nil }
44
44
  configuration.update(options) if options.is_a?(Hash)
45
45
 
46
- # Added for model Page
47
46
  belongs_to :parent, :class_name => name, :foreign_key => configuration[:foreign_key], :counter_cache => configuration[:counter_cache]
48
- if configuration[:dependent].nil?
49
- has_many :children, :class_name => name, :foreign_key => configuration[:foreign_key], :order => configuration[:order]
50
- else
51
- has_many :children, :class_name => name, :foreign_key => configuration[:foreign_key], :order => configuration[:order], :dependent => configuration[:dependent]
52
- end
47
+ has_many :children, :class_name => name, :foreign_key => configuration[:foreign_key], :order => configuration[:order], :dependent => :destroy
53
48
 
54
49
  class_eval <<-EOV
55
50
  include ActiveRecord::Acts::Tree::InstanceMethods
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aunderwo-acts_as_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - RailsJedi