README.md in uniqable-0.1.0 vs README.md in uniqable-0.1.1
- old
+ new
@@ -1,13 +1,11 @@
# Uniqable
[![CircleCI](https://circleci.com/gh/mpakus/uniqable.svg?style=svg)](https://circleci.com/gh/mpakus/uniqable)
-Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/uniqable`. To experiment with that code, run `bin/console` for an interactive prompt.
+Ruby on Rails gem for generating a unique, random token in an ActiveRecord model.
-TODO: Delete this and the text above, and describe your gem
-
## Installation
Add this line to your application's Gemfile:
```ruby
@@ -32,9 +30,19 @@
uniqable :uid, :another_column, :or_another_uid_column
end
```
It generates unique and random token before each Model instance is created.
+
+if you want you can use `:to_param` option to generate automatically `#to_param` method
+```ruby
+ uniqable :uid, :slug, to_param: :uid
+```
+
+anyway you have one more method `.find_uniqable` which one you can use to find your model record
+```ruby
+ MyModel.find_uniqable params[:uid]
+```
You can also create your own token callback method and set the field:
```ruby
def uniqable_uid(field)