PeterHamilton/citier — Issue #46: Getting citier to work with SQL server
Author: ianpetzer
Created: 2012-01-03 14:50:22+00:00
State: open

Hi,

I'm trying to get Citier working with SQL server but I'm having an issue when trying to insert a subclass into the database.

When using the Citier sample app for example, an insert is made into the database for the subtype (the 'book' in the sample app) giving it an id of 1, however when the insert is made into the root entity (the 'product in the sample app) it is given an id of 19.

The view is therefore unable to link the two entities.

The stack trace below shows this happening.

Could anyone point me in the right direction of where I should look to fix this issue. Even just a class name or some ideas would be great.

Below is the log showing the behaviour described above: (The only detail missing is the fact that the book was created with an id of 1)

Started POST "/books" for 127.0.0.1 at 2012-01-03 16:12:46 +0200
Processing by BooksController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ET5lKz/lt+/wOPv1vdHMWT/SKZEQqFqq9sJQ+hez698=", "book"=>{"title"=>"qwe", "author"=>"qwe"}, "commit"=>"Create Book"}
EXECUTE (33.8ms) BEGIN TRANSACTION
AREL (73.6ms) INSERT INTO [products] ([type], [name], [price], [created_at], [updated_at]) VALUES (N'Book', N'Title of book: qwe', NULL, '2012-01-03 14:12:46.740', '2012-01-03 14:12:46.740')
EXECUTE (46.2ms) COMMIT TRANSACTION
EXECUTE (33.4ms) BEGIN TRANSACTION
IDENTITY_INSERT (70.0ms) SET IDENTITY_INSERT [books] ON
AREL (36.7ms) INSERT INTO [books] ([title], [author], [id]) VALUES (N'qwe', N'qwe', 19)
IDENTITY_INSERT (34.7ms) SET IDENTITY_INSERT [books] OFF
EXECUTE (35.0ms) COMMIT TRANSACTION
Redirected to http://localhost:3000/books/19