show is not working: solution given
I'm using Rails 4.1.6 on sqlite3.
On the default (generated) controllers, show operation does not work.
The sql generated is the following: SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", "84857d86-9700-4bc2-b934-63ffedd76bee"]] But the working one is: SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", "\x84\x85}\x86\x97\x00K\xC2\xB94c\xFF\xED\xD7k\xEE"]]
I've solved the problem modifing the set method on the controller, to ensure String is used def set_post @post = Post.find(params[:id].to_s) end
I'm using sqlite and rails 4.1.8, I found that I needed the equivalent of
@drd = Drd.find(UUIDTools::UUID.parse(params[:id]))
to generate the functioning sql you describe. Have you found an alternative implementation of uuids as primary keys you like? This has me looking.
I'm using postgresql and its UUIDs