Project

General

Profile

Bug #5

Can not modify "technique"/"Support" property

Added by Pierre-Louis Bonicoli almost 11 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Normal
Category:
Database
Start date:
2009-01-04
Due date:
% Done:

0%

Estimated time:
Patch Available:
No
Confirmed:
No
Help Needed:

Description

In admin UI, "technique"/"support" property can not be modified : an error appears.

Steps to reproduce :
  1. Log with an admin account
  2. Go to "Gérer la cimaise / gérer les œuvres"
  3. Edit one painting (for example painting with name : "Bosquet et arbres morts / Le pavé des roizes")
  4. Change the technique/support property (select "Papier aquarelle")
  5. Validate modification
  6. Error appears :
    bq. ActiveRecord::StatementInvalid in Admin/artworksController#update
    Mysql::Error: Duplicate entry '8' for key 1: INSERT INTO `artworks_techniques` (`id`, `artwork_id`, `technique_id`) VALUES (8, 22, 8)

Impossible de modifier le support d'une œuvre


Related issues

Related to MyCyma - Cosmetic #4: Replace "technique" with "Support"/"Support" (En/Fr) | Changement de dénomination d'un item de la baseResolved2009-01-04

Actions

History

#1

Updated by Marc Dequènes over 10 years ago

  • Category changed from Database to Admin UI
#2

Updated by Marc Dequènes over 10 years ago

  • Category changed from Admin UI to Database
  • Status changed from New to Resolved

This was a database problem indeed. Rails does not handle extra fields well in simple HABTM model, instead of just ignoring it. Thus i removed the join table 'id' field for both supports and materials, and all is well better now. This was closed in commit aaa55822b2685cbeb2456458ce27673ee89083b6.

doc:
http://wiki.rubyonrails.org/howtos/db-relationships/basic?s[]=has&s[]=belongs
http://apidock.com/rails/ActiveRecord/Associations/ClassMethods/has_and_belongs_to_many

Also available in: Atom PDF