biddyweb / substruct

Automatically exported from code.google.com/p/substruct
0 stars 0 forks source link

uploading an image in development mode fails #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Start a fresh copy in development mode 
2.  create product
3.  upload image to product

What is the expected output? What do you see instead?
should work.  Instead says
ActiveRecord::AssociationTypeMismatch in Admin/productsController#save

Image expected, got Image

This has gotta be a bug in Rails.

What version of the product are you using? On what operating system?
1.0a2

Original issue reported on code.google.com by rogerpack2005 on 29 Feb 2008 at 11:46

GoogleCodeExporter commented 9 years ago
I cannot reproduce this.
Would be usefull if you put a full stack trace and describe it better, what OS, 
what
type of image.

Original comment by edmundo...@gmail.com on 1 Mar 2008 at 3:55

GoogleCodeExporter commented 9 years ago
ActiveRecord::AssociationTypeMismatch (Image expected, got Image):

/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:1
50:in
`raise_on_type_mismatch'

/vendor/rails/activerecord/lib/active_record/associations/has_many_through_assoc
iation.rb:57:in
`<<'

/vendor/rails/activerecord/lib/active_record/associations/has_many_through_assoc
iation.rb:56:in
`each'

/vendor/rails/activerecord/lib/active_record/associations/has_many_through_assoc
iation.rb:56:in
`<<'

/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/databa
se_statements.rb:66:in
`transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:80:in `transaction'

/vendor/rails/activerecord/lib/active_record/associations/has_many_through_assoc
iation.rb:55:in
`<<'
    /vendor/plugins/substruct/app/controllers/admin/products_controller.rb:100:in `save'
    /vendor/plugins/substruct/app/controllers/admin/products_controller.rb:94:in `each'
    /vendor/plugins/substruct/app/controllers/admin/products_controller.rb:94:in `save'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1158:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1158:in
`perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:697:in `call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:689:in
`perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
    /usr/lib64/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:199:in
`perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching.rb:678:in `perform_action'

/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_
cache.rb:33:in
`cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
    /vendor/rails/actionpack/lib/action_controller/caching.rb:677:in `perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in
`process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:685:in
`process_without_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:123:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:388:in `process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:171:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:115:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in `dispatch'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:76:in
`process'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:74:in
`synchronize'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:74:in
`process'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:159:in `process_client'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `each'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `process_client'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `initialize'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `new'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `initialize'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `new'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:282:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in `each'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:128:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/command.rb:212:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:281
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:489:in `load'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:489:in `load'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in
`new_constants_in'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:489:in `load'
    /vendor/rails/railties/lib/commands/servers/mongrel.rb:64
    /usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
    /usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in
`new_constants_in'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
    /vendor/rails/railties/lib/commands/server.rb:39
    /usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
    /usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    ./script/server:3
    /usr/lib64/ruby/gems/1.8/gems/ruby-debug-ide-0.1.10/lib/ruby-debug.rb:90:in
`debug_load'
    /usr/lib64/ruby/gems/1.8/gems/ruby-debug-ide-0.1.10/lib/ruby-debug.rb:90:in `main'
    /usr/lib64/ruby/gems/1.8/gems/ruby-debug-ide-0.1.10/bin/rdebug-ide:74
    /usr/bin/rdebug-ide:16:in `load'
    /usr/bin/rdebug-ide:16

Rendering
/home/alosix/projects/ruby/substruct/vendor/rails/actionpack/lib/action_controll
er/templates/rescues/layout.erb
(internal_server_error)
Attempting to copy plugin assets from
'/home/alosix/projects/ruby/substruct/vendor/plugins/substruct/assets' to
'/home/alosix/projects/ruby/substruct/public/plugin_assets'
  SQL (0.000081)   SET NAMES 'utf8'
  SQL (0.000048)   SET SQL_AUTO_IS_NULL=0
  Preference Columns (0.000455)   SHOW FIELDS FROM `preferences`
  Preference Load (0.000343)   SELECT * FROM `preferences` WHERE
(`preferences`.`name` = 'mail_host') LIMIT 1
  Preference Load (0.000184)   SELECT * FROM `preferences` WHERE
(`preferences`.`name` = 'mail_port') LIMIT 1
  Preference Load (0.000138)   SELECT * FROM `preferences` WHERE
(`preferences`.`name` = 'mail_auth_type') LIMIT 1
  Preference Load (0.000130)   SELECT * FROM `preferences` WHERE
(`preferences`.`name` = 'mail_username') LIMIT 1
  Preference Load (0.000132)   SELECT * FROM `preferences` WHERE
(`preferences`.`name` = 'mail_password') LIMIT 1
  SQL (0.036344)   DELETE FROM sessions
checking plugin 'engines' for 'application_helper'
checking plugin 'active_merchant' for 'application_helper'
checking plugin 'acts_as_tree' for 'application_helper'
checking plugin 'app_config' for 'application_helper'
checking plugin 'ar_fixtures' for 'application_helper'
checking plugin 'attachment_fu' for 'application_helper'
checking plugin 'substruct' for 'application_helper'
==> loading from plugin 'substruct'
checking plugin 'will_paginate' for 'application_helper'
(file not found in application)

Processing ProductsController#edit (for 127.0.0.1 at 2008-03-14 06:58:16) [GET]
  Session ID: b2c00ec704843af5dc28c45cf56e38c8
  Parameters: {"action"=>"edit", "id"=>"3", "controller"=>"admin/products"}
  Tag Load (0.000229)   SELECT * FROM `tags` WHERE (parent_id IS
NULL OR parent_id = 0) ORDER BY -rank DESC
  OrderUser Load (0.000124)   SELECT * FROM `order_users` WHERE
(`order_users`.`id` IS NULL) LIMIT 1
Redirected to http://localhost:3000/accounts/login
Filter chain halted as
[#<ActionController::Filters::ClassMethods::SymbolFilter:0x2b405948c0c8
@filter=:login_required>] rendered_or_redirected.
Completed in 0.00182 (549 reqs/sec) | DB: 0.08573 (4710%) | 302 Found
[http://localhost/admin/products/edit/3]
checking plugin 'engines' for 'application_helper'
checking plugin 'active_merchant' for 'application_helper'
checking plugin 'acts_as_tree' for 'application_helper'
checking plugin 'app_config' for 'application_helper'
checking plugin 'ar_fixtures' for 'application_helper'
checking plugin 'attachment_fu' for 'application_helper'
checking plugin 'substruct' for 'application_helper'
==> loading from plugin 'substruct'
checking plugin 'will_paginate' for 'application_helper'
(file not found in application)

Processing AccountsController#login (for 127.0.0.1 at 2008-03-14 06:58:16) [GET]
  Session ID: b2c00ec704843af5dc28c45cf56e38c8
  Parameters: {"action"=>"login", "controller"=>"accounts"}
  Tag Load (0.000216)   SELECT * FROM `tags` WHERE (parent_id IS
NULL OR parent_id = 0) ORDER BY -rank DESC
  OrderUser Load (0.000111)   SELECT * FROM `order_users` WHERE
(`order_users`.`id` IS NULL) LIMIT 1
Rendering template within layouts/accounts
Rendering accounts/login
Completed in 0.00514 (194 reqs/sec) | Rendering: 0.00380 (73%) | DB: 0.00033 
(6%) |
200 OK [http://localhost/accounts/login]
checking plugin 'engines' for 'application_helper'
checking plugin 'active_merchant' for 'application_helper'
checking plugin 'acts_as_tree' for 'application_helper'
checking plugin 'app_config' for 'application_helper'
checking plugin 'ar_fixtures' for 'application_helper'
checking plugin 'attachment_fu' for 'application_helper'
checking plugin 'substruct' for 'application_helper'
==> loading from plugin 'substruct'
checking plugin 'will_paginate' for 'application_helper'
(file not found in application)
checking plugin 'engines' for 'content_filesystem_controller'
checking plugin 'active_merchant' for 'content_filesystem_controller'
checking plugin 'acts_as_tree' for 'content_filesystem_controller'
checking plugin 'app_config' for 'content_filesystem_controller'
checking plugin 'ar_fixtures' for 'content_filesystem_controller'
checking plugin 'attachment_fu' for 'content_filesystem_controller'
checking plugin 'substruct' for 'content_filesystem_controller'
checking plugin 'will_paginate' for 'content_filesystem_controller'
loading from application: content_filesystem_controller
checking plugin 'engines' for 'content_filesystem_helper'
checking plugin 'active_merchant' for 'content_filesystem_helper'
checking plugin 'acts_as_tree' for 'content_filesystem_helper'
checking plugin 'app_config' for 'content_filesystem_helper'
checking plugin 'ar_fixtures' for 'content_filesystem_helper'
checking plugin 'attachment_fu' for 'content_filesystem_helper'
checking plugin 'substruct' for 'content_filesystem_helper'
checking plugin 'will_paginate' for 'content_filesystem_helper'
loading from application: content_filesystem_helper

Processing ContentFilesystemController#show (for 127.0.0.1 at 2008-03-14 
06:58:16) [GET]
  Session ID: b2c00ec704843af5dc28c45cf56e38c8
  Parameters: {"anything"=>["plugin_assets", "substruct", "stylesheets",
"substruct.css"], "action"=>"show", "controller"=>"content_filesystem"}
  Tag Load (0.000710)   SELECT * FROM `tags` WHERE (parent_id IS
NULL OR parent_id = 0) ORDER BY -rank DESC
  OrderUser Load (0.000089)   SELECT * FROM `order_users` WHERE
(`order_users`.`id` IS NULL) LIMIT 1
Rendering template within layouts/main
Rendering /mnt/Alfresco/www--jpowers/HEAD/DATA/www/avm_webapps/ROOT/404.html
Completed in 0.04335 (23 reqs/sec) | Rendering: 0.01849 (42%) | DB: 0.00080 
(1%) |
200 OK [http://localhost/plugin_assets/substruct/stylesheets/substruct.css]
checking plugin 'engines' for 'application_helper'
checking plugin 'active_merchant' for 'application_helper'
checking plugin 'acts_as_tree' for 'application_helper'
checking plugin 'app_config' for 'application_helper'
checking plugin 'ar_fixtures' for 'application_helper'
checking plugin 'attachment_fu' for 'application_helper'
checking plugin 'substruct' for 'application_helper'
==> loading from plugin 'substruct'
checking plugin 'will_paginate' for 'application_helper'
(file not found in application)

Processing AccountsController#login (for 127.0.0.1 at 2008-03-14 06:58:21) 
[POST]
  Session ID: b2c00ec704843af5dc28c45cf56e38c8
  Parameters: {"user_login"=>"admin", "action"=>"login", "controller"=>"accounts",
"user_password"=>"admin", "login"=>"Login"}
  Tag Load (0.000227)   SELECT * FROM `tags` WHERE (parent_id IS
NULL OR parent_id = 0) ORDER BY -rank DESC
  OrderUser Load (0.000139)   SELECT * FROM `order_users` WHERE
(`order_users`.`id` IS NULL) LIMIT 1
  User Load (0.000277)   SELECT * FROM `users` WHERE (login =
'admin' AND password = '652b1b54a914207f0cfd15de1967d8ebe26c1b94') LIMIT 1
Redirected to http://localhost:3000/admin/products/edit/3
Completed in 0.00429 (232 reqs/sec) | DB: 0.00064 (14%) | 302 Found
[http://localhost/accounts/login]
checking plugin 'engines' for 'application_helper'
checking plugin 'active_merchant' for 'application_helper'
checking plugin 'acts_as_tree' for 'application_helper'
checking plugin 'app_config' for 'application_helper'
checking plugin 'ar_fixtures' for 'application_helper'
checking plugin 'attachment_fu' for 'application_helper'
checking plugin 'substruct' for 'application_helper'
==> loading from plugin 'substruct'
checking plugin 'will_paginate' for 'application_helper'
(file not found in application)

Processing ProductsController#edit (for 127.0.0.1 at 2008-03-14 06:58:21) [GET]
  Session ID: b2c00ec704843af5dc28c45cf56e38c8
  Parameters: {"action"=>"edit", "id"=>"3", "controller"=>"admin/products"}
  Tag Load (0.000243)   SELECT * FROM `tags` WHERE (parent_id IS
NULL OR parent_id = 0) ORDER BY -rank DESC
  OrderUser Load (0.001055)   SELECT * FROM `order_users` WHERE
(`order_users`.`id` IS NULL) LIMIT 1
  User Load (0.000151)   SELECT * FROM `users` WHERE (`users`.`id`
= 1) 
  Join Table Columns (0.000447)   SHOW FIELDS FROM `roles_users`
  Role Load (0.000412)   SELECT * FROM `roles` INNER JOIN
roles_users ON roles.id = roles_users.role_id WHERE (roles_users.user_id = 1 ) 
ORDER
BY name ASC
  Join Table Columns (0.000370)   SHOW FIELDS FROM `rights_roles`
  Right Load (0.000294)   SELECT * FROM `rights` INNER JOIN
rights_roles ON rights.id = rights_roles.right_id WHERE (rights_roles.role_id = 
1 )
ORDER BY name ASC
[AUTH] content_nodes - *
[AUTH] files - *
[AUTH] orders - *
[AUTH] preferences - *
[AUTH] products - *
  CACHE (0.000000)   SELECT * FROM `tags` WHERE (parent_id IS NULL
OR parent_id = 0) ORDER BY -rank DESC
  Product Load (0.000273)   SELECT * FROM `items` WHERE
(`items`.`id` = 3) AND ( (`items`.`type` = 'Product' ) ) 
  Image Columns (0.000745)   SHOW FIELDS FROM `user_uploads`
Rendering template within layouts/admin
Rendering admin/products/edit
  SQL (0.000297)   SELECT count(*) AS count_all FROM `items` WHERE
(items.product_id = 3) AND ( (`items`.`type` = 'Variation' ) ) 
  Image Load (0.000377)   SELECT user_uploads.* FROM user_uploads
INNER JOIN product_images ON user_uploads.id = product_images.image_id WHERE
((product_images.product_id = 3)) AND ( (`user_uploads`.`type` = 'Image' ) ) 
ORDER BY
-product_images.rank DESC
Rendered /shared/_multiple_upload (0.00050)
Rendered admin/products/_form (0.00646)
  Join Table Columns (0.000435)   SHOW FIELDS FROM `products_tags`
  Tag Load (0.000200)   SELECT * FROM `tags` INNER JOIN
products_tags ON tags.id = products_tags.tag_id WHERE (products_tags.product_id 
= 3
) 
  Tag Load (0.000141)   SELECT * FROM `tags` WHERE (tags.parent_id
= 1) ORDER BY -rank DESC
Rendered admin/products/_tag_list_form_row (0.00245)
  Join Table Columns (0.000337)   SHOW FIELDS FROM
`related_products`
  Product Load (0.000204)   SELECT * FROM `items` INNER JOIN
related_products ON items.id = related_products.related_id WHERE
(related_products.product_id = 3 ) AND ( (`items`.`type` = 'Product' ) ) 
Rendered admin/products/_relative (0.00050)
Rendered admin/products/_relative (0.00040)
Rendered admin/products/_relative (0.00041)
Rendered admin/products/_relative (0.00040)
Rendered admin/products/_relative (0.00042)
Rendered admin/products/_crud_right (0.00722)
  CACHE (0.000000)   SELECT * FROM `users` WHERE (`users`.`id` = 1) 
Completed in 0.03369 (29 reqs/sec) | Rendering: 0.01704 (50%) | DB: 0.00598 
(17%) |
200 OK [http://localhost/admin/products/edit/3]
checking plugin 'engines' for 'application_helper'
checking plugin 'active_merchant' for 'application_helper'
checking plugin 'acts_as_tree' for 'application_helper'
checking plugin 'app_config' for 'application_helper'
checking plugin 'ar_fixtures' for 'application_helper'
checking plugin 'attachment_fu' for 'application_helper'
checking plugin 'substruct' for 'application_helper'
==> loading from plugin 'substruct'
checking plugin 'will_paginate' for 'application_helper'
(file not found in application)

Processing ProductsController#suggestion_js (for 127.0.0.1 at 2008-03-14 
06:58:21) [GET]
  Session ID: b2c00ec704843af5dc28c45cf56e38c8
  Parameters: {"action"=>"suggestion_js", "controller"=>"admin/products"}
  Tag Load (0.000295)   SELECT * FROM `tags` WHERE (parent_id IS
NULL OR parent_id = 0) ORDER BY -rank DESC
  OrderUser Load (0.000178)   SELECT * FROM `order_users` WHERE
(`order_users`.`id` IS NULL) LIMIT 1
  User Load (0.000220)   SELECT * FROM `users` WHERE (`users`.`id`
= 1) 
  Join Table Columns (0.000628)   SHOW FIELDS FROM `roles_users`
  Role Load (0.000643)   SELECT * FROM `roles` INNER JOIN
roles_users ON roles.id = roles_users.role_id WHERE (roles_users.user_id = 1 ) 
ORDER
BY name ASC
  Join Table Columns (0.000594)   SHOW FIELDS FROM `rights_roles`
  Right Load (0.000460)   SELECT * FROM `rights` INNER JOIN
rights_roles ON rights.id = rights_roles.right_id WHERE (rights_roles.role_id = 
1 )
ORDER BY name ASC
[AUTH] content_nodes - *
[AUTH] files - *
[AUTH] orders - *
[AUTH] preferences - *
[AUTH] products - *
  CACHE (0.000000)   SELECT * FROM `tags` WHERE (parent_id IS NULL
OR parent_id = 0) ORDER BY -rank DESC
  Product Load (0.000351)   SELECT * FROM `items` WHERE (
(`items`.`type` = 'Product' ) ) 
Rendering admin/products/suggestion_js
Completed in 0.01065 (93 reqs/sec) | Rendering: 0.00202 (18%) | DB: 0.00337 
(31%) |
200 OK [http://localhost/admin/products/suggestion_js]
checking plugin 'engines' for 'application_helper'
checking plugin 'active_merchant' for 'application_helper'
checking plugin 'acts_as_tree' for 'application_helper'
checking plugin 'app_config' for 'application_helper'
checking plugin 'ar_fixtures' for 'application_helper'
checking plugin 'attachment_fu' for 'application_helper'
checking plugin 'substruct' for 'application_helper'
==> loading from plugin 'substruct'
checking plugin 'will_paginate' for 'application_helper'
(file not found in application)

Processing ProductsController#save (for 127.0.0.1 at 2008-03-14 06:58:41) [POST]
  Session ID: b2c00ec704843af5dc28c45cf56e38c8
  Parameters: {"commit"=>"Save This Product", "product"=>{"name"=>"some other
product", "size_width"=>"0", "weight"=>"0", "code"=>"88889", "price"=>"88",
"tags"=>[""], "quantity"=>"88", "date_available(1i)"=>"2008", 
"size_height"=>"0",
"description"=>"", "date_available(2i)"=>"3", "date_available(3i)"=>"14",
"is_discontinued"=>"0", "related_product_ids"=>["", "", "", "", ""],
"size_depth"=>"0"}, "action"=>"save", "id"=>"3", "controller"=>"admin/products",
"image"=>[{"image_data_temp"=>"",
"image_data"=>#<ActionController::UploadedStringIO:0x2b405908cae0>},
{"image_data_temp"=>"", "image_data"=>""}]}
  Tag Load (0.000179)   SELECT * FROM `tags` WHERE (parent_id IS
NULL OR parent_id = 0) ORDER BY -rank DESC
  OrderUser Load (0.000087)   SELECT * FROM `order_users` WHERE
(`order_users`.`id` IS NULL) LIMIT 1
  User Load (0.000103)   SELECT * FROM `users` WHERE (`users`.`id`
= 1) 
  Join Table Columns (0.000372)   SHOW FIELDS FROM `roles_users`
  Role Load (0.000345)   SELECT * FROM `roles` INNER JOIN
roles_users ON roles.id = roles_users.role_id WHERE (roles_users.user_id = 1 ) 
ORDER
BY name ASC
  Join Table Columns (0.000308)   SHOW FIELDS FROM `rights_roles`
  Right Load (0.000282)   SELECT * FROM `rights` INNER JOIN
rights_roles ON rights.id = rights_roles.right_id WHERE (rights_roles.role_id = 
1 )
ORDER BY name ASC
[AUTH] content_nodes - *
[AUTH] files - *
[AUTH] orders - *
[AUTH] preferences - *
[AUTH] products - *
  CACHE (0.000000)   SELECT * FROM `tags` WHERE (parent_id IS NULL
OR parent_id = 0) ORDER BY -rank DESC
  Product Load (0.000197)   SELECT * FROM `items` WHERE
(`items`.`id` = 3) AND ( (`items`.`type` = 'Product' ) ) 
  Join Table Columns (0.000365)   SHOW FIELDS FROM `products_tags`
  Tag Load (0.000184)   SELECT * FROM `tags` INNER JOIN
products_tags ON tags.id = products_tags.tag_id WHERE (products_tags.product_id 
= 3
) 
  Join Table Columns (0.000315)   SHOW FIELDS FROM
`related_products`
  Product Load (0.000191)   SELECT * FROM `items` INNER JOIN
related_products ON items.id = related_products.related_id WHERE
(related_products.product_id = 3 ) AND ( (`items`.`type` = 'Product' ) ) 
  Product Load (0.000104)   SELECT * FROM `items` WHERE
(`items`.`code` IS NULL) AND ( (`items`.`type` = 'Product' ) ) LIMIT 1
  CACHE (0.000000)   SELECT * FROM `items` WHERE (`items`.`code` IS
NULL) AND ( (`items`.`type` = 'Product' ) ) LIMIT 1
  CACHE (0.000000)   SELECT * FROM `items` WHERE (`items`.`code`
IS NULL) AND ( (`items`.`type` = 'Product' ) ) LIMIT 1
  CACHE (0.000000)   SELECT * FROM `items` WHERE (`items`.`code` IS
NULL) AND ( (`items`.`type` = 'Product' ) ) LIMIT 1
  CACHE (0.000000)   SELECT * FROM `items` WHERE (`items`.`code`
IS NULL) AND ( (`items`.`type` = 'Product' ) ) LIMIT 1
  SQL (0.000045)   BEGIN
  Item Load (0.000247)   SELECT * FROM `items` WHERE (items.code =
'88889' AND items.id <> 3) LIMIT 1
  Product Update (0.000170)   UPDATE `items` SET `code` = '88889',
`variation_quantity` = 0, `quantity` = 88, `product_id` = 0, `size_depth` = 0.0,
`price` = 88.0, `type` = 'Product', `size_width` = 0.0, `description` = '', 
`weight`
= 0.0, `date_available` = '2008-03-14 00:00:00', `size_height` = 0.0,
`is_discontinued` = 0, `name` = 'some other product' WHERE `id` = 3
  SQL (0.000043)   COMMIT
  Image Columns (0.000632)   SHOW FIELDS FROM `user_uploads`
#<ActionController::UploadedStringIO:0x2b405908cae0>
  SQL (0.000059)   BEGIN
  Image Create (0.000385)   INSERT INTO `user_uploads`
(`content_type`, `created_on`, `size`, `thumbnail`, `type`, `filename`, 
`height`,
`parent_id`, `width`) VALUES('image/jpeg', '2008-03-14 06:58:41', 3886, NULL,
'Image', 'jesus.jpeg', 108, NULL, 124)
  Image Load (0.000280)   SELECT * FROM `user_uploads` WHERE
(`user_uploads`.`thumbnail` = 'small' AND `user_uploads`.`parent_id` = 49) AND (
(`user_uploads`.`type` = 'Image' ) ) LIMIT 1
  Image Create (0.000236)   INSERT INTO `user_uploads`
(`content_type`, `created_on`, `size`, `thumbnail`, `type`, `filename`, 
`height`,
`parent_id`, `width`) VALUES('image/jpeg', '2008-03-14 06:58:41', 3886, 'small',
'Image', 'jesus_small.jpeg', 174, 49, 200)
  Image Load (0.000301)   SELECT * FROM `user_uploads` WHERE
(`user_uploads`.`thumbnail` = 'thumb' AND `user_uploads`.`parent_id` = 49) AND (
(`user_uploads`.`type` = 'Image' ) ) LIMIT 1
  Image Create (0.000257)   INSERT INTO `user_uploads`
(`content_type`, `created_on`, `size`, `thumbnail`, `type`, `filename`, 
`height`,
`parent_id`, `width`) VALUES('image/jpeg', '2008-03-14 06:58:41', 3886, 'thumb',
'Image', 'jesus_thumb.jpeg', 44, 49, 50)
  SQL (0.094241)   COMMIT
  SQL (0.000058)   BEGIN
  SQL (0.000040)   ROLLBACK

ActiveRecord::AssociationTypeMismatch (Image expected, got Image):

/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:1
50:in
`raise_on_type_mismatch'

/vendor/rails/activerecord/lib/active_record/associations/has_many_through_assoc
iation.rb:57:in
`<<'

/vendor/rails/activerecord/lib/active_record/associations/has_many_through_assoc
iation.rb:56:in
`each'

/vendor/rails/activerecord/lib/active_record/associations/has_many_through_assoc
iation.rb:56:in
`<<'

/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/databa
se_statements.rb:66:in
`transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:80:in `transaction'

/vendor/rails/activerecord/lib/active_record/associations/has_many_through_assoc
iation.rb:55:in
`<<'
    /vendor/plugins/substruct/app/controllers/admin/products_controller.rb:100:in `save'
    /vendor/plugins/substruct/app/controllers/admin/products_controller.rb:94:in `each'
    /vendor/plugins/substruct/app/controllers/admin/products_controller.rb:94:in `save'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1158:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1158:in
`perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:697:in `call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:689:in
`perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
    /usr/lib64/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:199:in
`perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching.rb:678:in `perform_action'

/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_
cache.rb:33:in
`cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
    /vendor/rails/actionpack/lib/action_controller/caching.rb:677:in `perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in
`process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:685:in
`process_without_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:123:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:388:in `process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:171:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:115:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in `dispatch'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:76:in
`process'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:74:in
`synchronize'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:74:in
`process'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:159:in `process_client'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `each'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `process_client'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `initialize'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `new'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `initialize'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `new'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:282:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in `each'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:128:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/command.rb:212:in `run'
    /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:281
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:489:in `load'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:489:in `load'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in
`new_constants_in'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:489:in `load'
    /vendor/rails/railties/lib/commands/servers/mongrel.rb:64
    /usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
    /usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in
`new_constants_in'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
    /vendor/rails/railties/lib/commands/server.rb:39
    /usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
    /usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    ./script/server:3
    /usr/lib64/ruby/gems/1.8/gems/ruby-debug-ide-0.1.10/lib/ruby-debug.rb:90:in
`debug_load'
    /usr/lib64/ruby/gems/1.8/gems/ruby-debug-ide-0.1.10/lib/ruby-debug.rb:90:in `main'
    /usr/lib64/ruby/gems/1.8/gems/ruby-debug-ide-0.1.10/bin/rdebug-ide:74
    /usr/bin/rdebug-ide:16:in `load'
    /usr/bin/rdebug-ide:16

Rendering
/home/alosix/projects/ruby/substruct/vendor/rails/actionpack/lib/action_controll
er/templates/rescues/layout.erb
(internal_server_error)

Just ran into this myself after copying the image.rb file down and changing the
default image path.

It worked with the copy, but started dying after playing with the path. Still 
alittle
new to this and need to hack on it a little further.

Jason

Original comment by jpow...@gmail.com on 14 Mar 2008 at 10:57

GoogleCodeExporter commented 9 years ago
This looks like it was mostly related to me overiding the Image files. I 
removed a
lot of the duplicate stuff in my copy and it seemed to go away.

Still working getting them to successfully save in a different location, but at 
least
now its not exploding.

Original comment by jpow...@gmail.com on 14 Mar 2008 at 2:16

GoogleCodeExporter commented 9 years ago
Marking this as an invalid issue since you mentioned it was related to 
overriding image class...

Original comment by subim...@gmail.com on 9 Apr 2008 at 1:34

GoogleCodeExporter commented 9 years ago
Looks like it's a rails problem if you 'reinstantiate' classes.
see
http://www.ruby-forum.com/topic/101817 [link at the bottom]

Original comment by rogerpack2005 on 26 Apr 2008 at 3:44

GoogleCodeExporter commented 9 years ago
If you get this, this patch fixes rails' bug
[add this code in]

module ActiveRecord
  module Associations
    class AssociationProxy #:nodoc:

      private

        def raise_on_type_mismatch(record)
          unless record.class == @reflection.klass
            raise ActiveRecord::AssociationTypeMismatch, "#{@reflection.class_name} ID #{@reflection.id} expected, 
got #{record.class} ID #{record.id}"
          end
        end

    end
  end
end

Original comment by rogerpack2005 on 1 May 2008 at 5:52