activeuuid icon indicating copy to clipboard operation
activeuuid copied to clipboard

show is not working: solution given

Open mateuy-dev opened this issue 11 years ago • 2 comments

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

mateuy-dev avatar Oct 01 '14 15:10 mateuy-dev

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.

csavage-mdsol avatar Dec 22 '14 16:12 csavage-mdsol

I'm using postgresql and its UUIDs

mateuy-dev avatar Dec 23 '14 08:12 mateuy-dev