Hi Clemens,

Thanks for your reply. Just tried your suggestion and got the same
result as what I had before.... So I need to dig further!

Also, here is the exact error message I get:
  Track Load (0.5ms)   SELECT * FROM `tracks` WHERE
(`tracks`.course_id = 1949) ORDER BY tracks.from_date

NoMethodError (undefined method `from_date' for #<Array:0x106ce8388>):
  /usr/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.3/lib/
thinking_sphinx/attribute.rb:188:in `live_value'
  /usr/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.3/lib/
thinking_sphinx/active_record/attribute_updates.rb:37:in
`attribute_values_for_index'
  /usr/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.3/lib/
thinking_sphinx/active_record/attribute_updates.rb:36:in `each'
  /usr/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.3/lib/
thinking_sphinx/active_record/attribute_updates.rb:36:in `inject'
  /usr/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.3/lib/
thinking_sphinx/active_record/attribute_updates.rb:36:in
`attribute_values_for_index'
  /usr/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.3/lib/
thinking_sphinx/active_record/attribute_updates.rb:17:in
`update_attribute_values'
  /usr/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.3/lib/
thinking_sphinx/active_record/attribute_updates.rb:16:in `each'
  /usr/local/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.3/lib/
thinking_sphinx/active_record/attribute_updates.rb:16:in
`update_attribute_values'
  /usr/local/lib/ruby/gems/1.8/gems/after_commit-1.0.8/lib/
after_commit/connection_adapters.rb:129:in `send'
  /usr/local/lib/ruby/gems/1.8/gems/after_commit-1.0.8/lib/
after_commit/connection_adapters.rb:129:in
`trigger_after_commit_callbacks'
  /usr/local/lib/ruby/gems/1.8/gems/after_commit-1.0.8/lib/
after_commit/connection_adapters.rb:128:in `each'
  /usr/local/lib/ruby/gems/1.8/gems/after_commit-1.0.8/lib/
after_commit/connection_adapters.rb:128:in
`trigger_after_commit_callbacks'
  /usr/local/lib/ruby/gems/1.8/gems/after_commit-1.0.8/lib/
after_commit/connection_adapters.rb:36:in `commit_db_transaction'
  /usr/local/lib/ruby/gems/1.8/gems/after_commit-1.0.8/lib/
after_commit/connection_adapters.rb:12:in `transaction'
  app/controllers/courses/tracks_controller.rb:117:in `create'

Rendered rescues/_trace (265.1ms)

Not sure if that helps...

Alex



On Feb 27, 9:16 am, Clemens Kofler <[email protected]> wrote:
> Hi Alex,
>
> I could be wrong here but the correct syntax should be tracks.from_date 
> instead of tracks(:from_date). You only need the parenthesized syntax when 
> indexing columns with "special" meaning (e.g. id and name).
>
> HTH,
> - Clemens
>
> On Feb 27, 2011, at 6:12 PM, alex wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I have the following models:
>
> > Track
> >  belongs_to course, :touch => true
>
> > Course
> >  has_many tracks, :dependent => :destroy, :order =>
> > "tracks.from_date"
>
> >  define_index do
> >    ....
> >    has  tracks(:from_date), :as => :track_from_dates, :type
> > => :datetime
> >    has  tracks(:to_date), :as => :track_to_dates, :type => :datetime
> >  end
>
> > Everything works fine when I don't have the "has tracks(:from/
> > to_date)". However, with these 2 lines, I have a bug when I do create
> > a Course (even if not track is associated to it), or when I try to
> > create or destroy a Track associated to a Course. In every case, the
> > Course and Tracks are created and destroyed as planned, but I then get
> > the following error message:
>
> >  NoMethodError: undefined method `from_date' for #<Array:0x102962b90>
>
> > With error log involving activerecord-2.3.5, thinking-sphinx-1.3.11,
> > activesupport-2.3.5, after_commit-1.0.8.
>
> > I'm not sure where to look to debug it. Any idea?
>
> > Thanks!
>
> > --
> > 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.

Reply via email to