|
# From be764d2c9ce1c8f980f2cf3bf021bdbd5d05f605 Mon Sep 17 00:00:00 2001 |
|
# From: Aaron Patterson <aaron.patterson@gmail.com> |
|
# Date: Tue, 5 Mar 2013 14:52:08 -0800 |
|
# Subject: [PATCH] stop calling to_sym when building arel nodes |
|
|
|
# Drop it at your_app/config/initializers/ |
|
# Remember to pass your tests/specs |
|
class ActiveRecord::Base |
|
def self.expand_hash_conditions_for_aggregates(attrs) |
|
expanded_attrs = {} |
|
attrs.each do |attr, value| |
|
unless (aggregation = reflect_on_aggregation(attr)).nil? |
|
mapping = aggregate_mapping(aggregation) |
|
mapping.each do |field_attr, aggregate_attr| |
|
if mapping.size == 1 && !value.respond_to?(aggregate_attr) |
|
expanded_attrs[field_attr] = value |
|
else |
|
expanded_attrs[field_attr] = value.send(aggregate_attr) |
|
end |
|
end |
|
else |
|
expanded_attrs[attr] = value |
|
end |
|
end |
|
expanded_attrs |
|
end |
|
end |
|
|
|
module ActiveRecord::Reflection::ClassMethods |
|
def create_reflection(macro, name, options, active_record) |
|
case macro |
|
when :has_many, :belongs_to, :has_one, :has_and_belongs_to_many |
|
klass = options[:through] ? ActiveRecord::Reflection::ThroughReflection : ActiveRecord::Reflection::AssociationReflection |
|
reflection = klass.new(macro, name, options, active_record) |
|
when :composed_of |
|
reflection = ActiveRecord::Reflection::AggregateReflection.new(macro, name, options, active_record) |
|
# this line has been added for compatibility issues with has_many_polymorphs # |
|
when :has_many_polymorphs |
|
reflection = ActiveRecord::Reflection::PolymorphicReflection.new(macro, name, options, active_record) |
|
end |
|
write_inheritable_hiwa :reflections, name => reflection |
|
reflection |
|
end |
|
end |
|
|
|
class Class |
|
def write_inheritable_hiwa(key, hash) |
|
write_inheritable_attribute(key, {}.with_indifferent_access) if read_inheritable_attribute(key).nil? |
|
write_inheritable_attribute(key, read_inheritable_attribute(key).merge(hash)) |
|
end |
|
end |
El archivo cve_2013_1855.rb en realidad es para la vulnerabilidad CVE-2013-1856, este es el parche de la 1855 (según la web oficial https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/4_QHo4BqnN8 ):