Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: Mark Fraser
RE: MS SQL Server column type problem [ reply ]  
2007-08-14 16:56
I figured out the problem. The column name is "object_id". As a result there is no 'automatic' method of that name representing the column (because ,of course, object_id is already a member of any class).

Therefore the only way to reference it is via model_name.attributes["object_id"].

It makes me wonder whether the built-in to_xml should do this by default but in my case I will have to override to_xml for this model (unless someone has a better suggestion).


By: Mark Fraser
MS SQL Server column type problem [ reply ]  
2007-08-14 16:08
I am using ADO.rb and MSSQL.rb to connect to MS SQL Server 2000 from a rails application.

I have had no problems other than the following:

The (legacy) MS SQL database has several fields of 'nchar' type. All of these, save one, gets mapped to a Ruby string by AR.

The one field I am having trouble with is also an nchar and there is no apparent difference between the other nchar fields. However AR is mapping it to a "Fixnum" type. The field contains 32 character guids. This creates problems because the to_s method converts them into a numeric value.

Does anyone have any suggestions on what the problem (and solution) could be?

Thanks,

Mark