Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

STI debug #14

Closed
wants to merge 1 commit into from

2 participants

@sgruhier

Hi

I dont know if it's a good way to fix that, but solialization gem doesn't work well with STI only because rails uses base_classto store the class name in polymorphic column.

https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb#L14

I could add test if you think it worths to merge it

Thanks a lot for your gem!
Seb

Sébastien Gruhier STI compliant 02e8aae
@cmer
Owner

Yeah I think it's a worthwhile addition. Could you just add tests for it please?

Thanks

@sgruhier
@cmer
Owner

Closing for now because it's missing tests. I'd love to merge this in however.

@cmer cmer closed this
@cmer cmer reopened this
@cmer cmer closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 19, 2012
  1. STI compliant

    Sébastien Gruhier authored
This page is out of date. Refresh to see the latest.
View
2  lib/socialization/stores/active_record/follow.rb
@@ -51,7 +51,7 @@ def followers_relation(followable, klass, opts = {})
rel = klass.where(:id =>
self.select(:follower_id).
where(:follower_type => klass.table_name.classify).
- where(:followable_type => followable.class.to_s).
+ where(:followable_type => followable.class.base_class.to_s).
where(:followable_id => followable.id)
)
View
2  lib/socialization/stores/active_record/like.rb
@@ -77,7 +77,7 @@ def likeables_relation(liker, klass, opts = {})
rel = klass.where(:id =>
self.select(:likeable_id).
where(:likeable_type => klass.table_name.classify).
- where(:liker_type => liker.class.to_s).
+ where(:liker_type => liker.class.base_class.to_s).
where(:liker_id => liker.id)
)
View
2  lib/socialization/stores/active_record/mention.rb
@@ -51,7 +51,7 @@ def mentioners_relation(mentionable, klass, opts = {})
rel = klass.where(:id =>
self.select(:mentioner_id).
where(:mentioner_type => klass.table_name.classify).
- where(:mentionable_type => mentionable.class.to_s).
+ where(:mentionable_type => mentionable.class.base_class.to_s).
where(:mentionable_id => mentionable.id)
)
Something went wrong with that request. Please try again.