Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
Obfuscated ============== Obfuscated allows you to obfuscate the primary keys of your ActiveRecord models which use autoincrementing integer ids. Currently only works with MySQL. Just add "obfuscated" to your Gemfile! Example ======= class User < ActiveRecord::Base has_obfuscated_id end @user = User.first @user.id # 1 @user.hashed_id # "9b46a2e8c9db" @user.to_param # "9b46a2e8c9db" @same_user = User.find_by_hashed_id( "9b46a2e8c9db" ) Obfuscated will try to find the record using its obfuscated id when you pass a 12 digit string to find() : @same_user = User.find( "9b46a2e8c9db" ) @same_user = User.find( 1 ) As of 0.1.6, ActiveRelations also work: User.includes(:posts).find( "9b46a2e8c9db" ) Configuration ======= Set a salt for your app by adding initializers/obfuscated.rb: Obfuscated.salt = 'somerandomstringofcharacters' Copyright (c) 2008 Jon Collier, released under the MIT license