On Wednesday, April 22, 2015 at 8:10:47 PM UTC-7, [email protected] 
wrote:
>
> Hi,
>
> I'm using the single_table_inheritance plugin on a model and it works 
> properly for everything except destroying a model. When I call `destroy`, 
> it returns the model, but the database query used seems to cancel itself 
> out: `DELETE FROM "authorizations" WHERE (("authorizations"."type" != 
> "authorizations"."type") AND ("id" = 
> 'a01c758f-2b78-4773-a0e9-e781f605db99'))`
>
> Here's my configuration in the main class:
>
> ```
> plugin :single_table_inheritance, :type,
>   model_map: {
>     'oauth1' => 'OAuth1Authorization',
>     'oauth2' => 'OAuth2Authorization'
>   }
> ```
>
> Here's what the `sti_key_map` returns: `{"OAuth1Authorization"=>["oauth1"], 
> "OAuth2Authorization"=>["oauth2"]}`
>
> And here's what the `sti_model_map` returns: 
> `{"oauth1"=>"OAuth1Authorization", 
> "oauth2"=>"OAuth2Authorization"}`
>
> Any ideas?
>

I tried to reproduce the behavior you are seeing in a spec and 
unfortunately I wasn't able to.  Here's a link to the diff I tried: 
 http://pastie.org/pastes/10108530/text

Could you put together a self contained example I could run that shows the 
problem?  That way I should be able to run it and see what the problem is. 
 Right now, I'm not sure what could be causing the behavior you are seeing, 
unless OAuth1Authorization.dataset or OAuth2Authorization.dataset also have 
that SQL.  If OAuth1Authorization.dataset or OAuth2Authorization.dataset 
have that same SQL, my best guess is there is a mismatch between your class 
names and the values in the model_map, but that's probably not a good guess.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to