Skip to content
This repository

Allow Marshal.dump on objects that only have polymorphic associations where a polymorphic association is loaded #159

Merged
merged 1 commit into from about 1 year ago

2 participants

Grant Guthrie Ben Johnson
Grant Guthrie

Was incorrectly matching to _dump

Grant Guthrie Allow Marshal.dump on objects that only have polymorphic associations…
… where a polymorphic association is loaded

Was incorrectly matching to _dump
df5b6eb
Ben Johnson yourewelcome merged commit 6e2e030 into from April 05, 2013
Ben Johnson yourewelcome closed this April 05, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Dec 13, 2012
Grant Guthrie Allow Marshal.dump on objects that only have polymorphic associations…
… where a polymorphic association is loaded

Was incorrectly matching to _dump
df5b6eb
This page is out of date. Refresh to see the latest.
2  lib/searchlogic/named_scopes/association_conditions.rb
@@ -32,7 +32,7 @@ def association_condition_details(name, last_condition = nil)
32 32
           poly_type = nil
33 33
           condition = nil
34 34
 
35  
-          if name_with_condition.to_s =~ /^(#{non_poly_assocs.collect(&:name).join("|")})_(\w+)$/
  35
+          if name_with_condition.to_s =~ /^(#{non_poly_assocs.collect(&:name).join("|")})_(\w+)$/ && non_poly_assocs.present?
36 36
             association_name = $1
37 37
             condition = $2
38 38
           elsif name_with_condition.to_s =~ /^(#{poly_assocs.collect(&:name).join("|")})_(\w+?)_type_(\w+)$/
6  spec/searchlogic/named_scopes/association_conditions_spec.rb
@@ -217,4 +217,10 @@
217 217
     user.orders.id_equals(order1.id).count.should == 1
218 218
     user.orders.id_equals(order1.id).total_equals(2).count.should == 1
219 219
   end
  220
+
  221
+  it "should allow Marshal.dump on objects that only have polymorphic associations where a polymorphic association is loaded" do
  222
+    audit = Audit.create
  223
+    audit.auditable = User.create
  224
+    lambda { Marshal.dump(audit) }.should_not raise_error
  225
+  end
220 226
 end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.