Changeset 4318
- Timestamp:
- 04/30/06 20:36:37 (2 years ago)
- Files:
-
- trunk/activerecord/lib/active_record/calculations.rb (modified) (1 diff)
- trunk/activesupport/lib/active_support/ordered_options.rb (modified) (2 diffs)
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/lib/initializer.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/lib/active_record/calculations.rb
r4297 r4318 218 218 end 219 219 220 calculated_data.inject( OrderedHash.new) do |all, row|220 calculated_data.inject(ActiveSupport::OrderedHash.new) do |all, row| 221 221 key = associated ? key_records[row[group_alias].to_i] : type_cast_calculated_value(row[group_alias], group_column) 222 222 value = row[aggregate_alias] trunk/activesupport/lib/active_support/ordered_options.rb
r3646 r4318 1 class OrderedHash < Array #:nodoc: 1 # OrderedHash is namespaced to prevent conflicts with other implementations 2 class ActiveSupport::OrderedHash < Array #:nodoc: 2 3 def []=(key, value) 3 4 if pair = find_pair(key) … … 25 26 end 26 27 27 class OrderedOptions < OrderedHash #:nodoc:28 class OrderedOptions < ActiveSupport::OrderedHash #:nodoc: 28 29 def []=(key, value) 29 30 super(key.to_sym, value) trunk/railties/CHANGELOG
r4310 r4318 1 1 *SVN* 2 3 * Namespaced OrderedHash so the Rails implementation does not clash with any others. (fixes #4911) [Julian Tarkhanov] 2 4 3 5 * Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.] trunk/railties/lib/initializer.rb
r4316 r4318 449 449 450 450 for framework in default_frameworks 451 self.send("#{framework}=", OrderedOptions.new)451 self.send("#{framework}=", Rails::OrderedOptions.new) 452 452 end 453 453 end … … 577 577 578 578 # Needs to be duplicated from Active Support since its needed before Active 579 # Support is available. 580 class OrderedHash < Array #:nodoc: 581 def []=(key, value) 579 # Support is available. Here both Options and Hash are namespaced to prevent 580 # conflicts with other implementations AND with the classes residing in ActiveSupport. 581 class Rails::OrderedOptions < Array #:nodoc: 582 def []=(key, value) 583 key = key.to_sym 584 582 585 if pair = find_pair(key) 583 586 pair.pop … … 587 590 end 588 591 end 589 592 590 593 def [](key) 591 pair = find_pair(key )594 pair = find_pair(key.to_sym) 592 595 pair ? pair.last : nil 593 end594 595 def keys596 self.collect { |i| i.first }597 end598 599 private600 def find_pair(key)601 self.each { |i| return i if i.first == key }602 return false603 end604 end605 606 class OrderedOptions < OrderedHash #:nodoc:607 def []=(key, value)608 super(key.to_sym, value)609 end610 611 def [](key)612 super(key.to_sym)613 596 end 614 597 … … 620 603 end 621 604 end 605 606 private 607 def find_pair(key) 608 self.each { |i| return i if i.first == key } 609 return false 610 end 622 611 end