Forum: Ruby on Rails Issues using GUID plugin: IDs and acts_as_versioned

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Justin C. (Guest)
on 2006-05-06 07:37
(Received via mailing list)
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 C.
Co-President, Co-Founder
Two-Bit Operation LLC
http://www.twobitoperation.com
This topic is locked and can not be replied to.