README.md in rack-simple_user_agent-0.3.0.rc vs README.md in rack-simple_user_agent-0.3.0
- old
+ new
@@ -44,12 +44,31 @@
### on Rails
Installing `rack-simple_user_agent` automatically makes all detection methods available.
+#### Action Pack Variants Usage
+
These methods are useful when you use the Rails' [Action Pack Variants](http://guides.rubyonrails.org/4_1_release_notes.html#action-pack-variants) (as of Rails4.1).
+```rb
+class ApplicationController < ActionController::Base
+ before_action :set_request_variant
+
+ def set_request_variant
+ request.variant = :smartphone if request.from_smartphone?
+ end
+end
+```
+
+Then, you can use two types of view. For example:
+
+```
+app/views/projects/show.html.erb
+app/views/projects/show.html+smartphone.erb
+```
+
### on Sinatra
```rb
require "sinatra"
require "rack/simple_user_agent"
@@ -65,9 +84,15 @@
"Hello World from tablet"
else
"Hello World"
end
end
+```
+
+## Testing
+
+```bash
+bundle exec rake test
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.