That was it.  I removed my associations from the model and their
configs from my activescaffold product controller and added them one-
by-one until it failed.

Here is what happened:

class Product < ActiveRecord::Base
  has_many :category_products
  has_many :categories, :through => :category_products
  ...
end

class CategoryProduct < ActiveRecord::Base
  belongs_to :product
  belongs_to :category
end

class Category < ActiveRecord::Base
  has_many :category_products
  has_many :products, :through => :category_products
  ...
  validates_presence_of :title
end

class Admin::ProductController < ApplicationController
  active_scaffold :product do |config|
    ...
    update.columns = [... :category_products, ...]
    ...
  end
end

I added validation to my Category model when I added the title column
and there was no value in the title column for my categories that were
already in the database.  I guess when the Product model updated, it
failed validation on the Category model even though I never updated
the Category model, only the CategoryProduct model.  The validation
failed silently and was not displayed to the screen because category
is not included in my activescaffold product controller, only
indirectly through CategoryProducts.

Updating my category title column with good values fixed the issue.
If rails logged model validation failures, this would have been very
easy to diagnose.

On the bright side, I am now upgraded from 2.0.2 to 2.3.1 :)

Thanks everyone for your help

On Apr 15, 5:44 pm, <[email protected]> wrote:
> On Wed, 15 Apr 2009 10:02:26 -0700 (PDT), pattejam <[email protected]>
> wrote:
>
> > It is odd because I have not added any associations recently.
> > Wouldn't an association problem also manifest itself in the console?
>
> If some validation fails, save isn't executed, and it isn't logged in
> console.
>
>
>
> > On Apr 15, 4:12 am, "Sergio Cambra .:: entreCables S.L. ::."
> > <[email protected]> wrote:
> >> El Wednesday 15 April 2009 01:08:49 pattejam escribió:
>
> >> > I am suddenly having problems updating records from a particular class
> >> > and I cannot seem to track down why.  All of my other models are
> >> > working correctly and I have been doing some form_column overrides,
> >> > but nothing out of the ordinary.
>
> >> If your don't get updates, the record or some associations aren't valid.
> >> Check your associated models.
>
> >> > ruby 1.8.5 (2006-08-25) [i486-linux]
> >> > rails 2.0.2
>
> >> > When I do an update, I never see an update in SQL.
>
> >> > It appears to update as normal from but just loads with the same
> >> > record open.
>
> >> > I can update the record from the console just fine.
>
> >> > >> @p = Product.find(643)
>
> >> > => #<Product id: 643, ...... status: "Discontinued">
>
> >> > >> @p.status = "Active"
>
> >> > => "Active"
>
> >> > >> @p.save
>
> >> > => true
>
> >> > >> @p = Product.find(643)
>
> >> > => #<Product id: 643, .......  status: "Active">
>
> >> > excerpt from development.log
>
> >> > Processing ProductController#update (for 192.168.1.6 at 2009-04-14
> >> > 19:07:25) [PUT]
> >> >   Session ID: 850aed1df43c1d5ef746a52db4bfcdfa
> >> >   Parameters: {"commit"=>"Update",
> >> > "authenticity_token"=>"b994deb197b5c70d4e2d4dc52a8ef66c6014da7c",
> >> > "_method"=>"put", "action"=>"update", "id"=>"643",
> >> > "category_id"=>"43", "controller"=>"admin/product",
> >> > "associated_id"=>"", "record"=>{"status"=>"Discontinued".......
> >> >   Manufacturer Columns (0.001171)   SHOW FIELDS FROM `manufacturers`
> >> >   Product Load (0.000209)   SELECT * FROM `products` WHERE
> >> > (`products`.`id` = 643)
> >> >   SQL (0.000184)   BEGIN
> >> >   Manufacturer Load (0.000202)   SELECT * FROM `manufacturers` WHERE
> >> > (`manufacturers`.`id` = 30)
> >> >   CACHE (0.000000)   SELECT * FROM `manufacturers` WHERE
> >> > (`manufacturers`.`id` = 30)
> >> >   CategoryProduct Columns (0.000943)   SHOW FIELDS FROM
> >> > `category_products`
> >> >   CategoryProduct Load (0.000184)   SELECT * FROM `category_products`
> >> > WHERE (category_products.product_id = 643)
> >> >   Category Columns (0.001450)   SHOW FIELDS FROM `categories`
> >> >   Category Load (0.000196)   SELECT * FROM `categories` WHERE
> >> > (`categories`.`id` = 43)
> >> >   Fitment Columns (0.001136)   SHOW FIELDS FROM `fitments`
> >> >   Fitment Load (0.001428)   SELECT * FROM `fitments` WHERE
> >> > (fitments.product_id = 643)
> >> >   ProductOption Columns (0.001121)   SHOW FIELDS FROM
> >> > `product_options`
> >> >   ProductOption Load (0.000230)   SELECT * FROM `product_options`
> >> > WHERE (product_options.product_id = 643)
> >> >   Image Columns (0.001309)   SHOW FIELDS FROM `images`
> >> >   Image Load (0.000171)   SELECT * FROM `images` WHERE
> >> > (images.product_id = 643)
> >> >   ProductGuide Columns (0.000986)   SHOW FIELDS FROM `product_guides`
> >> >   ProductGuide Load (0.000300)   SELECT * FROM `product_guides` WHERE
> >> > (product_guides.product_id = 643)
> >> >   EbayItemSpecific Columns (0.001085)   SHOW FIELDS FROM
> >> > `ebay_item_specifics`
> >> >   EbayItemSpecific Load (0.000184)   SELECT * FROM
> >> > `ebay_item_specifics` WHERE (ebay_item_specifics.product_id = 643)
> >> >   Product Load (0.002078)   SELECT * FROM `products` WHERE
> >> > (products.product_number = '1050320' AND products.id <> 643) LIMIT 1
> >> >   SQL (0.000186)   COMMIT
> >> > Rendering admin/product/update.rjs
> >> > Rendered admin/product/_agent_form_column (0.00131)
> >> > Rendered admin/product/_form_attribute (0.00148)
> >> > Rendered admin/product/_form_attribute (0.00146)
> >> > Rendered admin/product/_form_attribute (0.00159)
> >> > Rendered admin/product/_form_attribute (0.00157)
> >> > Rendered admin/product/_form_attribute (0.00139)
> >> > Rendered admin/product/_form_attribute (0.00166)
> >> > Rendered admin/product/_form_attribute (0.00159)
> >> > Rendered admin/product/_form_attribute (0.00016)
> >> > Rendered admin/product/_form_attribute (0.00161)
> >> > Rendered admin/product/_form_attribute (0.00156)
> >> > Rendered admin/product/_form_attribute (0.00138)
> >> > Rendered admin/product/_form_attribute (0.00153)
> >> > Rendered admin/product/_form_attribute (0.00390)
> >> > Rendered admin/product/_form_attribute (0.00136)
> >> > Rendered admin/product/_form_attribute (0.00159)
> >> > Rendered admin/product/_form_attribute (0.00134)
> >> > Rendered admin/product/_form_attribute (0.00163)
> >> >   Manufacturer Load (0.000468)   SELECT * FROM `manufacturers`
> >> > Rendered admin/product/_form_attribute (0.10940)
> >> > Rendered admin/product/_form_association_header (0.02663)
> >> >   Category Load (0.000280)   SELECT * FROM `categories`
> >> > Rendered admin/product/_form_attribute (0.00803)
> >> > Rendered admin/product/_form_association_record (0.03074)
> >> >   CACHE (0.000000)   SELECT * FROM `categories`
> >> > Rendered admin/product/_form_attribute (0.00711)
> >> > Rendered admin/product/_form_association_record (0.02207)
> >> >   SQL (0.000210)   SELECT count(*) AS count_all FROM
> >> > `category_products` WHERE (product_id IS NULL)
> >> > Rendered admin/product/_form_association_footer (0.00967)
> >> > Rendered admin/product/_form_association (0.10537)
> >> > Rendered admin/product/_form_association_header (0.00582)
> >> > Rendered admin/product/_form_attribute (0.00162)
> >> > Rendered admin/product/_form_attribute (0.00165)
> >> >   AutoMake Columns (0.000982)   SHOW FIELDS FROM `auto_makes`
> >> >   AutoMake Load (0.000196)   SELECT * FROM `auto_makes` WHERE
> >> > (`auto_makes`.`id` = 8)
> >> >   AutoMake Load (0.000190)   SELECT * FROM `auto_makes`
> >> > Rendered admin/product/_form_attribute (0.01577)
> >> >   AutoModel Columns (0.001049)   SHOW FIELDS FROM `auto_models`
> >> >   AutoModel Load (0.000182)   SELECT * FROM `auto_models` WHERE
> >> > (`auto_models`.`id` = 27)
> >> >   AutoModel Load (0.000185)   SELECT * FROM `auto_models`
> >> > Rendered admin/product/_form_attribute (0.01523)
> >> >   AutoEngine Columns (0.001187)   SHOW FIELDS FROM `auto_engines`
> >> >   AutoEngine Load (0.000250)   SELECT * FROM `auto_engines` WHERE
> >> > (`auto_engines`.`id` = 38)
> >> >   AutoEngine Load (0.000265)   SELECT * FROM `auto_engines`
> >> > Rendered admin/product/_form_attribute (0.12318)
> >> > Rendered admin/product/_form_association_record (0.17722)
> >> > Rendered admin/product/_form_attribute (0.00185)
> >> > Rendered admin/product/_form_attribute (0.00171)
> >> >   AutoMake Load (0.000350)   SELECT * FROM `auto_makes` WHERE
> >> > (`auto_makes`.`id` = 6)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_makes`
> >> > Rendered admin/product/_form_attribute (0.00382)
> >> >   AutoModel Load (0.000304)   SELECT * FROM `auto_models` WHERE
> >> > (`auto_models`.`id` = 12)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_models`
> >> > Rendered admin/product/_form_attribute (0.00414)
> >> >   AutoEngine Load (0.000292)   SELECT * FROM `auto_engines` WHERE
> >> > (`auto_engines`.`id` = 10)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_engines`
> >> > Rendered admin/product/_form_attribute (0.00342)
> >> > Rendered admin/product/_form_association_record (0.03676)
> >> > Rendered admin/product/_form_attribute (0.00183)
> >> > Rendered admin/product/_form_attribute (0.00193)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_makes` WHERE
> >> > (`auto_makes`.`id` = 6)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_makes`
> >> > Rendered admin/product/_form_attribute (0.00262)
> >> >   AutoModel Load (0.000216)   SELECT * FROM `auto_models` WHERE
> >> > (`auto_models`.`id` = 10)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_models`
> >> > Rendered admin/product/_form_attribute (0.00403)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_engines` WHERE
> >> > (`auto_engines`.`id` = 10)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_engines`
> >> > Rendered admin/product/_form_attribute (0.00318)
> >> > Rendered admin/product/_form_association_record (0.03420)
> >> > Rendered admin/product/_form_attribute (0.00172)
> >> > Rendered admin/product/_form_attribute (0.00170)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_makes`
> >> > Rendered admin/product/_form_attribute (0.00259)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_models`
> >> > Rendered admin/product/_form_attribute (0.00322)
> >> >   CACHE (0.000000)   SELECT * FROM `auto_engines`
> >> > Rendered admin/product/_form_attribute (0.00290)
> >> > Rendered admin/product/_form_association_record (0.03252)
> >> >   SQL (0.000220)   SELECT count(*) AS count_all FROM `fitments` WHERE
> >> > (product_id IS NULL)
> >> > Rendered admin/product/_form_association_footer (0.00571)
> >> > Rendered admin/product/_form_association (0.31623)
> >> > Rendered admin/product/_form_association_header (0.01272)
> >> > Rendered admin/product/_form_attribute (0.00144)
> >> > Rendered admin/product/_form_attribute (0.00163)
> >> > Rendered admin/product/_form_attribute (0.00163)
> >> > Rendered admin/product/_form_attribute (0.00158)
> >> > Rendered admin/product/_form_attribute (0.00173)
> >> > Rendered admin/product/_form_association_record (0.03574)
> >> >   SQL (0.000197)   SELECT count(*) AS count_all FROM
> >> > `product_options`
> >> > WHERE (product_id IS NULL)
> >> > Rendered admin/product/_form_association_footer (0.00965)
> >> > Rendered admin/product/_form_association (0.06492)
> >> > Rendered admin/product/_form_association_header (0.00484)
> >> > Rendered admin/product/_form_attribute (0.00158)
> >> > Rendered admin/product/_form_attribute (0.00157)
> >> > Rendered admin/product/_form_association_record (0.01380)
> >> >   SQL (0.000205)   SELECT count(*) AS count_all FROM `images`
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to