I see your point that Rails is following the STI pattern.
However I can't see why the column should be static in the schema and not 
to use the virtual one. I will have to spare some time to work on this to 
find out whats going to happen.

Thank you!

On Tuesday, June 10, 2014 5:42:11 PM UTC+3, Xavier Noria wrote:
>
> On Tue, Jun 10, 2014 at 4:34 PM, Ivailo Bardarov <[email protected] 
> <javascript:>> wrote:
>
> Doesn't matter if the column comes statically or dynamically. The presence 
>> of the "type" virtual-column in the record should be enough.
>>
>>  record[inheritance_column].present?
>>
>> instead of
>>
>> record[inheritance_column].present? && columns_hash.include?(
>> inheritance_column)
>>
>> What do you think?
>>
>
>
> AR assumes the column exists. STI needs the column to perform certain 
> queries related to the hierarchy as I showed before.
>
> If AR cannot assume the column exists, then we need to introduce logic to 
> account for that in those queries, and so on. The design deviates. There's 
> no need for the design to deviate, AR models STI and STI has a type column.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to