What's the output of the following in script/console?

  contact.status = 'deleted'
  contact.send(:should_toggle_delta?)

-- 
Pat

On 29/06/2010, at 6:55 PM, Jim Ruther Nill wrote:

> It's not setting the delta when I updated the status.  I tried it in the 
> console and it didn't work this time, weird.  It was working earlier.  I just 
> restarted the console, and it didn't work.
> 
> here's a snippet of my log when I try to update the status of the contact.
> 
> Processing ContactsController#destroy (for 127.0.0.1 at 2010-06-29 16:53:19) 
> [DELETE]
>   Parameters: {"action"=>"destroy", "_method"=>"delete", 
> "authenticity_token"=>"YfnlGTCHA1X2wttwbnOjlYMrTR06c3Ui6YXIzsSHUVI=", 
> "id"=>"1", "controller"=>"contacts"}
>   User Columns (1.9ms)   SHOW FIELDS FROM `users`
>   User Load (0.2ms)   SELECT * FROM `users` WHERE (`users`.`id` = 4) LIMIT 1
>   PaygUser Columns (1.8ms)   SHOW FIELDS FROM `payg_users`
>   Contact Columns (1.1ms)   SHOW FIELDS FROM `contacts`
>   Contact Load (0.5ms)   SELECT * FROM `contacts` WHERE (`contacts`.`id` = 
> '1') AND (`contacts`.user_id = 4 AND (`contacts`.`status` = 'active')) ORDER 
> BY contacts.name ASC LIMIT 1
>   SQL (0.9ms)   BEGIN
>   Contact Update (0.4ms)   UPDATE `contacts` SET `updated_at` = '2010-06-29 
> 08:53:20', `status` = 'deleted' WHERE `id` = 1
>   SQL (2.1ms)   COMMIT
> Redirected to http://localhost:3000/contacts
> Completed in 477ms (DB: 9) | 302 Found [http://localhost/contacts/1]
> 
> 
> On Tue, Jun 29, 2010 at 4:43 PM, Pat Allan <[email protected]> wrote:
> But that same code works in script/console?
> 
> When looking at the logs from script/server, are you seeing delta being set 
> to 1 when updating the status?
> 
> --
> Pat
> 
> On 29/06/2010, at 6:40 PM, Jim Ruther Nill wrote:
> 
> > I think update_attribute fires callbacks, it just doesn't pass through 
> > validations (which is what I want).  So instead of update_attribute, I used
> >
> > contact.status = 'deleted'
> > contact.save(false)
> >
> > but the index is still not updating :(
> >
> >
> > On Tue, Jun 29, 2010 at 4:17 PM, Pat Allan <[email protected]> 
> > wrote:
> > The issue here could be update_attribute - it doesn't fire callbacks, I'm 
> > pretty sure. update_attributes (note the plural) does - give that a shot?
> >
> > --
> > Pat
> >
> > On 29/06/2010, at 6:09 PM, Jim Ruther Nill wrote:
> >
> > > My define_index block
> > >
> > > define_index do
> > >     indexes :name, :sortable => true
> > >     indexes [country_code, phone_number], :as => :full_number, :sortable 
> > > => true
> > >     indexes groups(:name), :as => :gnames, :sortable => true
> > >
> > >     where "status = 'active'"
> > >
> > >     has user_id
> > >     has groups(:id), :as => :group_ids
> > >
> > >     set_property :delta => true
> > >   end
> > >
> > > I'm updating a contact's status in the console by using update_attribute.
> > > Same thing I'm doing when a link is clicked.
> > >
> > >
> > > On Tue, Jun 29, 2010 at 3:38 PM, Pat Allan <[email protected]> 
> > > wrote:
> > > Hmm, right. So just script/server which is invoking Mongrel, I'm guessing.
> > >
> > > What does your define_index block look like? And what change are you 
> > > making to the object? Or more to the point: are you making the exact same 
> > > change in the console that the link is making?
> > >
> > > TS won't always set delta to true if it can figure out it's not necessary.
> > >
> > > --
> > > Pat
> > >
> > > On 29/06/2010, at 5:26 PM, Jim Ruther Nill wrote:
> > >
> > > > I have passenger installed but I'm not using that.  I'm just running 
> > > > the server in my local machine.
> > > >
> > > > On Tue, Jun 29, 2010 at 3:21 PM, Pat Allan <[email protected]> 
> > > > wrote:
> > > > Sounds like a PATH issue... I'm guessing you're using Passenger?
> > > >
> > > > http://freelancing-god.github.com/ts/en/common_issues.html#passenger
> > > >
> > > > --
> > > > Pat
> > > >
> > > > On 29/06/2010, at 4:28 PM, Jim Ruther Nill wrote:
> > > >
> > > > > Hi Pat,
> > > > >
> > > > >
> > > > > I just want to ask what's the difference between updating a record in 
> > > > > the console and in the app.  I'm working on a new app which saves 
> > > > > contacts.  When I try to update the contact's status using the 
> > > > > console, the indexer fires up. Good.  But when I use a link, for 
> > > > > example, to update the status, the indexer does not fire up.
> > > > >
> > > > > Any thoughts?
> > > > >
> > > > >
> > > > > -------------------------------------------------------------
> > > > > visit my blog at http://jimlabs.heroku.com
> > > > >
> > > > > --
> > > > > 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.
> > > >
> > > > --
> > > > 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.
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------
> > > > visit my blog at http://jimlabs.heroku.com
> > > >
> > > > --
> > > > 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.
> > >
> > > --
> > > 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.
> > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------
> > > visit my blog at http://jimlabs.heroku.com
> > >
> > > --
> > > 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.
> >
> > --
> > 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.
> >
> >
> >
> >
> > --
> > -------------------------------------------------------------
> > visit my blog at http://jimlabs.heroku.com
> >
> > --
> > 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.
> 
> --
> 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.
> 
> 
> 
> 
> -- 
> -------------------------------------------------------------
> visit my blog at http://jimlabs.heroku.com
> 
> -- 
> 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.

-- 
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