diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/mixins/list.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/mixins/list.rb b/activerecord/lib/active_record/mixins/list.rb index a1d914d73c..f092347478 100644 --- a/activerecord/lib/active_record/mixins/list.rb +++ b/activerecord/lib/active_record/mixins/list.rb @@ -36,6 +36,8 @@ module ActiveRecord def acts_as_list(options = {}) configuration = { :column => "position", :scope => "1" } configuration.update(options) if options.is_a?(Hash) + + configuration[:scope] = "#{configuration[:scope]}_id".intern if configuration[:scope].is_a?(Symbol) && configuration[:scope].to_s !~ /_id$/ class_eval <<-EOV include InstanceMethods @@ -45,11 +47,7 @@ module ActiveRecord end def scope_condition - if configuration[:scope].is_a?(Symbol) - "#{configuration[:scope]} = \#{#{configuration[:scope]}}" - else - configuration[:scope] - end + "#{configuration[:scope].is_a?(Symbol) ? configuration[:scope].to_s + " = \#{" + configuration[:scope].to_s + "}" : configuration[:scope]}" end before_destroy :remove_from_list |