Just to add in the "has "deleted_at IS NULL", :as => :is_active, :type => :boolean" line.
On Feb 22, 10:52 pm, Aaron Brethorst <[email protected]> wrote: > did you modify the define_index block? > > On Feb 22, 2010, at 2:48 PM, Colin wrote: > > > > > I tried your suggestion and also tried replacing the { :conditions => > > ["deleted_at IS NULL"] } with {:conditions => {:deleted_at => nil}} > > but in both cases it seems to be returning an empty array. > > > On Feb 22, 10:34 pm, Aaron Brethorst <[email protected]> wrote: > >> Pat could certainly speak to this better than I, but I was under the > >> impression that conditions are only used in conjunction with fields that > >> have been marked with 'indexes'. > > >> I was actually doing something similar to what you're trying to accomplish > >> earlier today. Maybe you could do something like the following: > > >> # note: untested code; written in my Mail app > > >> define_index do > >> # all of your existing stuff goes here > >> has "deleted_at IS NULL", :as => :is_active, :type => :boolean > >> end > > >> sphinx_scope(:active_ts) { > >> { :with => {:is_active => true} } > > >> } > > >> On Feb 22, 2010, at 2:21 PM, Colin wrote: > > >>> Thank you for the link. > >>> It fixed the original error but it is now throwing: > > >>> undefined method `keys' for ["deleted_at IS NULL"] > > >>> So would I be right in thinking that I can't use the ["deleted_at IS > >>> NULL"] syntax to define a condition? > > >>> Regards, > > >>> Colin > > >>> On Feb 22, 8:50 pm, Aaron Brethorst <[email protected]> wrote: > >>>> Try declaring your sphinx_scopes after define_index. > > >>>>http://brethorsting.com/blog/2010/02/solution-for-undefined-method-sp... > > >>>> On Feb 22, 2010, at 12:46 PM, Colin wrote: > > >>>>> Hi, > > >>>>> I'm getting the above error when I try to declare a sphinx_scope. > >>>>> I've googled around but couldn't find a solution. > >>>>> The model in question can be found here:http://pastie.org/837509 > > >>>>> I've tried it in the syntax shown above and also a direct copy of the > >>>>> named_scope syntax. > > >>>>> Any ideas? > > >>>>> Regards, > > >>>>> Colin > > >>>>> -- > >>>>> 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 > >>>>> athttp://groups.google.com/group/thinking-sphinx?hl=en. > > >>> -- > >>> 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 > >>> athttp://groups.google.com/group/thinking-sphinx?hl=en. > > > -- > > 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 > > athttp://groups.google.com/group/thinking-sphinx?hl=en. -- 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.
