After having tried pretty much every solution out there for CTI in AR, I''m now trying out the native postgres inheritance support. After a couple of activerecord hacks, I have it mostly working, but am running into some issues. The main problem seems to come when a child model is loaded through an association which points to the parent. Code is here: https://gist.github.com/929866 It seems that in some cases, activerecord queries the parent tables attributes to determine the valid attributes instead of the child. Sometimes calling reload brings in the actions. However, when inside an association, it seems a different version of reload gets called from activerecord::relation instead of activerecord::persistence. That version of reload seems to always use the parent table. I''ve spent a few hours inside the internals of AR, but I''m in over my head. Any activerecord ninjas out there have any idea how I can work around that? And if any core team members are around, any chance of a real CTI implementation ever making it into activerecord? I''ve seen about a million workarounds for this, but they''re all pretty brittle. Thanks! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
This is all with rails 3.0.6 btw -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I think your issues have to do with your use of the type column and it triggering rails STI magic. STI is assuming all columns are defined on the parent and will never attempt to loan column names from the child tables. I am investigating using native postgres inheritance for a project I''m working on, I''ll post back if I get anywhere with it. On Apr 19, 6:03 pm, mixtli <ronmcclai...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> After having tried pretty much every solution out there for CTI in AR, > I''m now trying out the native postgres inheritance support. After a > couple of activerecord hacks, I have it mostly working, but am running > into some issues. The main problem seems to come when a child model > is loaded through an association which points to the parent. Code is > here: https://gist.github.com/929866 > > It seems that in some cases, activerecord queries the parent tables > attributes to determine the valid attributes instead of the child. > Sometimes calling reload brings in the actions. However, when inside > an association, it seems a different version of reload gets called > from activerecord::relation instead of activerecord::persistence. > That version of reload seems to always use the parent table. > I''ve spent a few hours inside the internals of AR, but I''m in over my > head. Any activerecord ninjas out there have any idea how I can work > around that? > > And if any core team members are around, any chance of a real CTI > implementation ever making it into activerecord? > I''ve seen about a million workarounds for this, but they''re all pretty > brittle. > > Thanks!-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.