README.md in action_callback-0.1.0 vs README.md in action_callback-0.2.0
- old
+ new
@@ -1,10 +1,10 @@
[](https://travis-ci.org/EdmundLeex/action_callback)
# CallbackAction
-This gem gives you ability to add callbacks like `before_action` / `before_fitler` etc to your class.
+This gem gives you ability to add callbacks like `before_action` / `before_fitler` etc to your Active Record models and plain ruby classes.
## Installation
Add this line to your application's Gemfile:
@@ -20,16 +20,14 @@
$ gem install callback_action
## Usage
-If you are using plain ruby:
+If you are using Rails, in your Active Record models:
```ruby
-class Foobar
- extend ActionCallback
-
+class Foobar < ActiveRecord::Base
before_action :foobar, on: [:foo, :bar]
def foo
# ...
end
@@ -42,14 +40,15 @@
# ...
end
end
```
-If you are using Rails, you can save the `extend ActionCallback` line in active record models
-(but you will still need that when you are defining a plain ruby class):
+If you are using plain ruby:
```ruby
-class Foobar < ActiveRecord::Base
+class Foobar
+ extend ActionCallback
+
before_action :foobar, on: [:foo, :bar]
def foo
# ...
end