summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-05-24 10:16:58 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-05-24 10:16:58 +0000
commite22c5c3f80df692cad6397dc41c9dfcb6171e5b3 (patch)
treebd49fdd661c9b64e6669edb3ee628cb88e6403ae
parent43e84c6c1070671ee0e86f52e58ebb6f8d83b938 (diff)
downloadredmine-e22c5c3f80df692cad6397dc41c9dfcb6171e5b3.tar.gz
redmine-e22c5c3f80df692cad6397dc41c9dfcb6171e5b3.zip
awesome_nested_set: import git 2-1-stable branch revision 3d5ac746542b564 (#6579)
https://github.com/collectiveidea/awesome_nested_set/commit/3d5ac746542b564 git-svn-id: http://svn.redmine.org/redmine/trunk@13144 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/plugins/awesome_nested_set/.travis.yml3
-rw-r--r--lib/plugins/awesome_nested_set/Gemfile6
-rw-r--r--lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb6
-rw-r--r--lib/plugins/awesome_nested_set/lib/awesome_nested_set/model/rebuildable.rb4
4 files changed, 14 insertions, 5 deletions
diff --git a/lib/plugins/awesome_nested_set/.travis.yml b/lib/plugins/awesome_nested_set/.travis.yml
index 0456da4fa..ad9e670a3 100644
--- a/lib/plugins/awesome_nested_set/.travis.yml
+++ b/lib/plugins/awesome_nested_set/.travis.yml
@@ -8,10 +8,9 @@ env:
rvm:
- 2.0.0
- 1.9.3
- - rbx-19mode
+ - rbx
- jruby-19mode
- 1.8.7
- - rbx-18mode
- jruby-18mode
gemfile:
- gemfiles/Gemfile.rails-3.0.rb
diff --git a/lib/plugins/awesome_nested_set/Gemfile b/lib/plugins/awesome_nested_set/Gemfile
index cf7cf11fe..ca0c5f95c 100644
--- a/lib/plugins/awesome_nested_set/Gemfile
+++ b/lib/plugins/awesome_nested_set/Gemfile
@@ -23,6 +23,12 @@ gem 'railties', RAILS_VERSION
gem 'activerecord', RAILS_VERSION
gem 'actionpack', RAILS_VERSION
+platforms :rbx do
+ gem 'rubysl', '~> 2.0'
+ gem 'rubysl-test-unit'
+end
+
+
# Add Oracle Adapters
# gem 'ruby-oci8'
# gem 'activerecord-oracle_enhanced-adapter'
diff --git a/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb b/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb
index 95c3516c1..603c177d1 100644
--- a/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb
+++ b/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb
@@ -92,7 +92,8 @@ module CollectiveIdea #:nodoc:
:foreign_key => parent_column_name,
:counter_cache => acts_as_nested_set_options[:counter_cache],
:inverse_of => (:children unless acts_as_nested_set_options[:polymorphic]),
- :polymorphic => acts_as_nested_set_options[:polymorphic]
+ :polymorphic => acts_as_nested_set_options[:polymorphic],
+ :touch => acts_as_nested_set_options[:touch]
end
def acts_as_nested_set_default_options
@@ -103,7 +104,8 @@ module CollectiveIdea #:nodoc:
:depth_column => 'depth',
:dependent => :delete_all, # or :destroy
:polymorphic => false,
- :counter_cache => false
+ :counter_cache => false,
+ :touch => false
}.freeze
end
diff --git a/lib/plugins/awesome_nested_set/lib/awesome_nested_set/model/rebuildable.rb b/lib/plugins/awesome_nested_set/lib/awesome_nested_set/model/rebuildable.rb
index 553c308c1..335736d72 100644
--- a/lib/plugins/awesome_nested_set/lib/awesome_nested_set/model/rebuildable.rb
+++ b/lib/plugins/awesome_nested_set/lib/awesome_nested_set/model/rebuildable.rb
@@ -23,7 +23,9 @@ module CollectiveIdea
if acts_as_nested_set_options[:scope]
scope = proc {|node|
scope_column_names.inject("") {|str, column_name|
- str << "AND #{connection.quote_column_name(column_name)} = #{connection.quote(node.send(column_name))} "
+ column_value = node.send(column_name)
+ cond = column_value.nil? ? "IS NULL" : "= #{connection.quote(column_value)}"
+ str << "AND #{connection.quote_column_name(column_name)} #{cond} "
}
}
end