Justin Chen
2006-May-06 03:34 UTC
[Rails] Issues using GUID plugin: IDs and acts_as_versioned
Hi, First off, I think the GUID plugin is very slick ( http://wiki.rubyonrails.org/rails/pages/Uses+Guid+Plugin). However, I''m running into a few issues: ISSUE #1) Rails'' handling of IDs as strings instead of integers. In particular, it didn''t seem to work when I had a model doing "acts_as_list" with a scope: Example: Class Big < ActiveRecord::Base usesguid has_many :littles end Class Little < ActiveRecord::Base usesguid belongs_to :big acts_as_list :scope => big_id end It seems like the generated SQL queries wouldn''t put the ID with string quotations. I get an error like: Mysql::Error: Unknown column ''ayMi4o3iyr2OYfabBlKsEs'' in ''where clause'': SELECT * FROM littles WHERE (big_id = ayMi4o3iyr2OYfabBlKsEs) ORDER BY position DESC LIMIT 1 ISSUE #2) acts_as_versioned method "create_versioned_tables" assumes integer for the foreign key id of the table to be versioned Example: (using the same class as above) It will generate a "big_versions" table with: - id int (this is fine) - big_id int (this should be a string since tables "bigs" has an ID that is a string) Question: For either issue, is there a setting I could change that maybe I''m missing? Otherwise, I''ll probably not use the acts_as_list at this time (for issue #1) and modify the create_versioned_table to do a string instead of integer for this case (for issue #2). Thanks, Justin -- Justin Chen Co-President, Co-Founder Two-Bit Operation LLC http://www.twobitoperation.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060506/0bf4f6d1/attachment.html