Hi Hendra
I think you have a syntax error in your definition - it should be 'indexes' not
'index' for each field.
Cheers
--
Pat
On 01/03/2012, at 1:21 AM, Hendra Gunawan wrote:
> I have my RoR Application with Rails 3.1.3
> I try to run "rake ts:config", but it always return error "At least one field
> is necessary for an index", any body can help me to solve this problem?
>
> I think I already define index in my model, Training, but when I run rake
> task to generate ts configuration, it always return error.
>
> Here is my model:
>
> # == Schema Information
> #
> # Table name: trainings
> #
> # id :integer(4) not null, primary key
> # user_id :integer(4)
> # name :string(255)
> # description :text
> # created_at :datetime
> # updated_at :datetime
> #
> class Training < ActiveRecord::Base
>
> # attributes
> attr_accessor :training_tags
>
> # relations
> belongs_to :user
>
> has_many :training_tag_relations
> has_many :tags, :through => :training_tag_relations
>
> # return flatten tag in array
> def flatten_tag
> tags.map { |t| t.name }
> end
>
> # call back after create
> after_create :create_training_tags
>
> # define index for mapping
> define_index do
> # field
> index :name, :sortable => true
> index :description
> index tags.name, :as => :tag_name
>
> # attribetus
> has :user_id, :created_at, :updated_at
> end
>
> end
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/thinking-sphinx/-/IUmro6olVIIJ.
> 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.
--
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.