On Wednesday, September 24, 2014 10:47:34 AM UTC-7, binarypaladin wrote:
>
> So, I have something like this:
>
> class StiModel
>   plugin :single_table_inheritance, :type, model_map: { 'model_a' => 
> :ModelA, 'model_b' => :ModelB }
> end
>
> class ModelA < StiModel
> end
>
> class ModelB < StiModel
> end
>
> Nothing fancy.
>
> When I create a new model like this:
>
> m = StiModel.new(type: 'model_a').save
> #<StiModel @values={id=>1, :type=>'model_a}>
>
> Is there a way to convert this into ModelA without doing something like 
> StiModel.with_pk(1)?
>

StiModel.call(m.values) should work.

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