Hi Blake (and others) using 2.0.x

I've added a manual call to load_models again - as while 2.1 calls the  
prepare callback on initial load as well as reloads, 2.0.2 only calls  
it on reloads. As discussed in other emails, the load_models call is  
required for proper STI handling - models have to know about their  
subclasses.

I realise this will open up some problems for you again - if you've  
got the time, would love to help debug this, find the best solution.

Sorry for the hassle.

-- 
Pat

On 19/09/2008, at 9:32 PM, Blake Watters wrote:

> This fix also prevented my application from bombing out at plugin  
> load time. We do _not_ use code reloading because the app is just  
> too big. Thanks :-)
>
> On Fri, Sep 19, 2008 at 9:59 AM, Pat Allan <[EMAIL PROTECTED] 
> gods.com> wrote:
>
> Figured it out, pushed a patch - the code in a plugin's init.rb
> doesn't get called every time models are reloaded (ie: every request
> when in dev environment). Thankfully there's a callback that fires
> when the reload happens, so can handle it.
>
> Does raise the question for how this happens in Merb though... any
> Merb gurus on the list that can check out STI searching from the
> parent class?
>
> --
> Pat
>
> On 19/09/2008, at 11:23 AM, Pat Allan wrote:
>
> >
> > Ah, using an STI parent, I get the same issue (using 2.1.0).
> > Curious... but now I can look into it a bit more.
> >
> > Cheers
> >
> > --
> > Pat
> >
> > On 19/09/2008, at 4:35 AM, zubin wrote:
> >
> >>
> >> Hi Pat,
> >>
> >> Something else I noticed:
> >> The issue only happens when searching the parent class (BuyPage).
> >> TS indexes are only defined in BuyPage, not in the child classes.
> >>
> >>>> ClothingBuyPage.search "lace"
> >> => [#<ClothingBuyPage id: 23, ...]
> >>>> reload!
> >> Reloading...
> >> => true
> >>>> ClothingBuyPage.search "lace"
> >> => [#<ClothingBuyPage id: 23, ...]
> >>
> >> btw I'm on Rails 2.1.1
> >>
> >> -Zubin
> >>
> >>
> >> On Sep 18, 4:54 pm, Pat Allan <[EMAIL PROTECTED]> wrote:
> >>> Hi Zubin
> >>>
> >>> I just tried this in 2.1.0 (the console issue, anyway), and I got
> >>> search results after the #reload! call. I'll grab the 2.1.1 gems
> >>> now,
> >>> set up another test environment, see if I can recreate it there.
> >>>
> >>> Cheers
> >>>
> >>> --
> >>> Pat
> >>>
> >>> On 18/09/2008, at 1:23 PM, zubin wrote:
> >>>
> >>>
> >>>
> >>>> Hey folks, anyone had trouble with search results disappearing
> >>>> after a
> >>>> reload?
> >>>
> >>>> In development, I get search results after a server restart (not
> >>>> ts).
> >>>> But any subsequent searches yield no results.
> >>>
> >>>> Here's what happens in console (similar). Presumably this  
> simulates
> >>>> Rails' behaviour in development in that the AR models get  
> reloaded
> >>>> on
> >>>> each request.
> >>>
> >>>> $ ./script/console
> >>>> Loading development environment (Rails 2.1.1)
> >>>>>> BuyPage.search "lace", :per_page => 5
> >>>> => [#<ClothingBuyPage id: 30, type: "ClothingBuyPage", code:
> >>>> "312-62",
> >>>> record_id: 30, enabled: true, name: "312 tri top diamond lace",
> >>>> content: nil>, #<ClothingBuyPage id: 52, type: "ClothingBuyPage",
> >>>> code: "328-00", record_id: 52, enabled: true, name: "328 lace-up
> >>>> top
> >>>> matt lycra", content: nil>, #<ClothingBuyPage id: 64, type:
> >>>> "ClothingBuyPage", code: "335-00", record_id: 64, enabled: true,
> >>>> name:
> >>>> "335 lace-up bandeau matt lycra", content: nil>,  
> #<ClothingBuyPage
> >>>> id:
> >>>> 110, type: "ClothingBuyPage", code: "446-62", record_id: 110,
> >>>> enabled:
> >>>> true, name: "446 bottom diamond lace", content: nil>,
> >>>> #<ClothingBuyPage id: 241, type: "ClothingBuyPage", code:  
> "490-00",
> >>>> record_id: 241, enabled: true, name: "490 lace-up bottom matt
> >>>> lycra",
> >>>> content: nil>]
> >>>>>> reload!
> >>>> Reloading...
> >>>> => true
> >>>>>> BuyPage.search "lace", :per_page => 5
> >>>> => []
> >>>
> >>>> --
> >>>> # buy_page.rb
> >>>
> >>>> # thinking-sphinx options
> >>>> define_index do
> >>>>   indexes :name, :sortable => true
> >>>>   has :type # used for sorting
> >>>>   where "enabled = 1"
> >>>> end
> >>>
> >>>> --
> >>>> I've tried removing everything except "indexes :name" and
> >>>> reindexing
> >>>> and restarting ts.
> >>>
> >
> > >
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to