They are quite a few but here they are
belongs_to :address
belongs_to :parent_league, :class_name=>
"League", :foreign_key=>:parent_id
has_one :wall, :as=>:wallable, :dependent => :destroy
has_one :background, :as => :background_holder, :dependent
=> :destroy
has_many :sub_leagues, :class_name =>
"League", :foreign_key=>:parent_id, :dependent => :nullify
has_many :league_championships, :dependent => :delete_all
has_many :championships, :through => :league_championships, :uniq
=> true
has_many :league_associations, :dependent => :delete_all
has_many :events, :through => :league_associations, :source
=> :league_associator, :source_type => "Event", :class_name =>
"Event", :uniq => true
has_many :teams, :through=>:league_associations, :source
=> :league_associator, :source_type => "Team", :class_name =>
"Team", :uniq => true
has_many :athletes, :through=>:league_associations, :source
=> :league_associator, :source_type => "Athlete", :class_name =>
"Athlete", :uniq => true
has_many :clubs, :through=>:league_associations, :source
=> :league_associator, :source_type => "Club", :class_name =>
"Club", :uniq => true
has_many :schools, :through=>:league_associations, :source
=> :league_associator, :source_type => "School", :class_name =>
"School", :uniq => true
has_many :rss_links, :as=>:rss_holder, :dependent => :destroy
has_many :images, :as => :image_holder, :dependent => :destroy
has_many :videos, :as => :video_holder, :dependent => :destroy
has_many :sponsorships, :as => :sponsored, :dependent => :delete_all
has_many :brands, :through => :sponsorships, :uniq => true
has_many :profile_links, :as => :profile_link_holder, :dependent
=> :delete_all
has_many :product_associations, :as => :associator, :dependent
=> :delete_all
has_many :products, :through => :product_associations, :uniq => true
has_many :roles, :as => :authorization
has_many :league_sports, :dependent =>:destroy
has_many :sports, :through => :league_sports, :uniq => true
has_many :favorites, :as => :favorited, :dependent => :delete_all
has_many :users, :through => :favorites, :uniq => true
has_many :statistics, :finder_sql => 'SELECT * FROM statistics WHERE
(
(statistic_holder_id IN (SELECT DISTINCT
athletes.id FROM athletes INNER JOIN league_associations ON
athletes.id = league_associations.league_associator_id AND
league_associations.league_associator_type = "Athlete" WHERE
((league_associations.league_id = #{id})) ) AND statistic_holder_type
= "Athlete")
OR (statistic_holder_id IN (SELECT DISTINCT
teams.id FROM teams INNER JOIN league_associations ON teams.id =
league_associations.league_associator_id AND
league_associations.league_associator_type = "Team" WHERE
((league_associations.league_id = #{id})) ) AND statistic_holder_type
= "Team"))
',
:counter_sql => 'SELECT count(*) FROM statistics WHERE (
(statistic_holder_id IN (SELECT DISTINCT
athletes.id FROM athletes INNER JOIN league_associations ON
athletes.id = league_associations.league_associator_id AND
league_associations.league_associator_type = "Athlete" WHERE
((league_associations.league_id = #{id})) ) AND statistic_holder_type
= "Athlete")
OR (statistic_holder_id IN (SELECT DISTINCT
teams.id FROM teams INNER JOIN league_associations ON teams.id =
league_associations.league_associator_id AND
league_associations.league_associator_type = "Team" WHERE
((league_associations.league_id = #{id})) ) AND statistic_holder_type
= "Team"))
' do
def find(* args)
options = args.extract_options!
sql = @finder_sql
sql += sanitize_sql [" LIMIT ?", options[:limit]] if
options[:limit]
sql += sanitize_sql [" OFFSET ?", options[:offset]] if
options[:offset]
Statistic.find_by_sql(sql)
end
end
has_many :records, :finder_sql => 'SELECT * FROM records WHERE (
(record_holder_id IN (SELECT DISTINCT
athletes.id FROM athletes INNER JOIN league_associations ON
athletes.id = league_associations.league_associator_id AND
league_associations.league_associator_type = "Athlete" WHERE
((league_associations.league_id = #{id})) ) AND record_holder_type =
"Athlete")
OR (record_holder_id IN (SELECT DISTINCT
teams.id FROM teams INNER JOIN league_associations ON teams.id =
league_associations.league_associator_id AND
league_associations.league_associator_type = "Team" WHERE
((league_associations.league_id = #{id})) ) AND record_holder_type =
"Team"))
',
:counter_sql => 'SELECT count(*) FROM records WHERE (
(record_holder_id IN (SELECT DISTINCT
athletes.id FROM athletes INNER JOIN league_associations ON
athletes.id = league_associations.league_associator_id AND
league_associations.league_associator_type = "Athlete" WHERE
((league_associations.league_id = #{id})) ) AND record_holder_type =
"Athlete")
OR (record_holder_id IN (SELECT DISTINCT
teams.id FROM teams INNER JOIN league_associations ON teams.id =
league_associations.league_associator_id AND
league_associations.league_associator_type = "Team" WHERE
((league_associations.league_id = #{id})) ) AND record_holder_type =
"Team"))
' do
def find(* args)
options = args.extract_options!
sql = @finder_sql
sql += sanitize_sql [" LIMIT ?", options[:limit]] if
options[:limit]
sql += sanitize_sql [" OFFSET ?", options[:offset]] if
options[:offset]
Record.find_by_sql(sql)
end
end
has_many :tickets, :finder_sql => 'select distinct tickets.* from
tickets INNER JOIN league_associations ON tickets.event_id =
league_associations.league_associator_id
where
(league_associations.league_id = #{id} AND
league_associations.league_associator_type = "Event" )
',
:counter_sql => 'select count(*) from tickets INNER JOIN
league_associations ON tickets.event_id =
league_associations.league_associator_id
where
(league_associations.league_id = #{id} AND
league_associations.league_associator_type = "Event" )
' do
def find(* args)
options = args.extract_options!
sql = @finder_sql
sql += sanitize_sql [" LIMIT ?", options[:limit]] if
options[:limit]
sql += sanitize_sql [" OFFSET ?", options[:offset]] if
options[:offset]
Ticket.find_by_sql(sql)
end
end
define_index do
indexes :name, :sortable=> true
indexes :description
indexes :short_name
indexes :other_names
indexes
address.geography.country_name, :as=>:country_name, :sortable=> true
indexes
address.geography.region_name, :as=>:region_name, :sortable=> true
indexes address.geography.city_name, :as=>:city_name, :sortable=>
true
indexes sub_leagues.name, :as=>:league_names
indexes teams.name, :as=>:team_names
indexes clubs.name, :as=>:club_names
indexes sports.name, :as=>:sport_names
has :id, :parent_id, :created_at, :updated_at, :hit_count, :address_id
has address(:geography_id), :as=>:geography_id, :facet=>true
has address.geography(:country_id), :as=>:country_id, :facet=>true
has address.geography(:region_id), :as=>:region_id, :facet=>true
has address.geography(:city_id), :as=>:city_id, :facet=>true
has sports(:id), :as=>:sport_ids, :facet=>true
has sports.sport_family(:id), :as=>:sport_family_ids, :facet=>true
has "3", :as => :custom_model_sort, :type => :integer
set_property :delta => :delayed
end
On Feb 2, 5:35 pm, Pat Allan <[email protected]> wrote:
> Hi Dave
>
> Can you show us what the associations and define_index block on the League
> model are?
>
> Cheers
>
> --
> Pat
>
> On 03/02/2011, at 4:44 AM, gerberdata wrote:
>
> > Hello Group,
>
> > I am using thinking sphinx 1.3.20 and when
> > running ts:conf I am not seeing one of my models in the config file
> > unless I remove two associations. Please have a look at this
>
> > has_many :sub_leagues, :class_name =>
> > "League", :foreign_key=>:parent_id, :dependent => :nullify
> > has_many :profile_links, :as => :profile_link_holder, :dependent
> > => :delete_all
>
> > this is in league model. There is no defined indexes on these in the
> > define_index method if I comment out these two associations no problem
> > the config file gets generated. I have tried to remove each one and
> > run seperately but the config file still does not generate the
> > league_core as expected. These relationships look pretty run of the
> > mill to me. I have a table profile_links with profile_link_holder_id
> > and profile_link_holder_type.
> > anyway anyone's help would be appreciated.
>
> > Thanks
> > Dave
>
> > --
> > 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.