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
This commit is contained in:
Toshi MARUYAMA
2014-05-24 10:16:58 +00:00
parent 43e84c6c10
commit e22c5c3f80
4 changed files with 14 additions and 5 deletions

View File

@@ -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

View File

@@ -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'

View File

@@ -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

View File

@@ -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