thx a lot~ changing apt config will be alright~ (=゚ω゚)ノ yep i made some stupid mistake including my awkward english~ (*≧∇≦*)
Pat Allan於 2015年5月11日星期一 UTC+8下午8時05分00秒寫道: > > Hi Frank > > Because you’re using real-time indices, whichever table the model points > to when a record is created/updated is what will be used. So, the code > you’ve got (without the table_name option) should work with the standard > Apartment approach. Are you finding that’s not the case? Are you doing > something custom with table names? > > Unrelated, but what’s your reasoning for having network_id, created_at and > updated_at as string attributes instead of integer and timestamp attributes? > > Cheers > > — > Pat > > On 11 May 2015, at 9:42 pm, Frank H <[email protected] <javascript:>> > wrote: > > dear Pat&All how can i define a index whose name is different from it's > table name by real_time~ appreciate~ ◑ω◐ > i've worked hard to approach this: > > http://www.rubydoc.info/github/pat/thinking-sphinx/ThinkingSphinx/Index#define-class_method > i'm using the apartment to do the multitenancy~ my code is as following~ > sorry for disturbing~ have a good one~ d(-_^) > > current_tenant = Apartment::Tenant.current > > *# Each Tenant instance is tied to a tenant in this example.* > > Tenant.find_each *do* |tenant| > > *# Switch to the appropriate Apartment tenant.* > > Apartment::Tenant.switch tenant.db > > > ThinkingSphinx::Index.define( > > *:topic*, > > *# with: :active_record,* > > *# delta: true,* > > *name*: "topic_*#{*tenant.db*}*", > > *table_name: "topic",(wanted) * > > *offset_as*: "topic_*#{*tenant.db*}*".to_sym, > > *with*: *:real_time* )*do* > > > *# fields* > > indexes name, *sortable*: *true* > > > *# attributes* > > has network_id,created_at, updated_at, *:type* => *:string* > > > *# For real-time indices, let's make sure we're using the appropriate > tenant.* > > scope { Apartment::Tenant.switch tenant.db; Topic } > > *end* > > *end* *if* Tenant.table_exists? > > > *# Switching back to the original tenant - this is useful in the > development* > > *# environment, as indices (and thus, this file) can be reloaded, and we > don't* > > *# want to always leave our app on our last tenant.* > > Apartment::Tenant.switch current_tenant > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at http://groups.google.com/group/thinking-sphinx. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" 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/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.
