jashmenn / activeuuid

Binary uuid keys in Rails
MIT License
340 stars 124 forks source link

Problems with the search by id #64

Closed dx0x58 closed 9 years ago

dx0x58 commented 9 years ago

I have some problem after installing the gem (Rails 4.1.8). When I make the first request to the controller after starting the server. Rails looks for record id as a string (!):

Host Load (0.4ms) SELECThosts. * FROM hostsWHEREhosts.id= '67e5f9ba88aa464898214a1112d0d5a6' LIMIT 1

And I get the error:

Could not find Host with 'id' = 67e5f9ba88aa464898214a1112d0d5a6

I found a bad solution. I think that the problem with the cache Rails.

  1. Setting config.cache_classes = false in produciton.rb
  2. I do recursive touch like: find. -exec touch {} \; in the application directory
  3. Then make a second request to the controller. And now looking for Rails id like binary:

Host Load (0.4ms) SELECThosts. * FROM hostsWHEREhosts.id= x'67e5f9ba88aa464898214a1112d0d5a6 'LIMIT 1

  1. It work