https://github.com/collectiveidea/interactor-rails
Interactor Rails provides Rails support for the Interactor gem.
https://github.com/collectiveidea/interactor-rails
interactor interactor-rails rails ruby
Last synced: 7 months ago
JSON representation
Interactor Rails provides Rails support for the Interactor gem.
- Host: GitHub
- URL: https://github.com/collectiveidea/interactor-rails
- Owner: collectiveidea
- License: mit
- Created: 2013-08-17T04:14:51.000Z (over 12 years ago)
- Default Branch: main
- Last Pushed: 2024-12-24T02:33:09.000Z (11 months ago)
- Last Synced: 2025-04-13T10:50:05.619Z (8 months ago)
- Topics: interactor, interactor-rails, rails, ruby
- Language: Ruby
- Size: 68.4 KB
- Stars: 448
- Watchers: 14
- Forks: 45
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-rails-gems - collectiveidea / interactor-rails
README
# Interactor Rails
[](http://rubygems.org/gems/interactor-rails)
[](https://github.com/collectiveidea/interactor-rails/actions/workflows/tests.yml)
[](https://codeclimate.com/github/collectiveidea/interactor-rails)
[](https://codeclimate.com/github/collectiveidea/interactor-rails)
Interactor Rails provides Rails support for the
[Interactor](https://github.com/collectiveidea/interactor) gem.
## Installation
Add this line to your application's Gemfile:
```ruby
gem "interactor-rails", "~> 2.0"
```
Interactor Rails is tested against Ruby 3.1 and newer on Rails 7.0 or newer.
For older versions of Ruby and Rails use version 2.2.1.
## Usage
Interactor Rails ensures that `app/interactors` is included in your autoload
paths, and provides generators for your convenience.
```bash
rails generate interactor authenticate_user
```
adds to `app/interactors/authenticate_user.rb`:
```ruby
class AuthenticateUser
include Interactor
def call
# TODO
end
end
```
There is also a generator for organizers.
```bash
rails generate interactor:organizer place_order charge_card send_thank_you fulfill_order
```
adds to `app/interactors/place_order.rb`:
```ruby
class PlaceOrder
include Interactor::Organizer
organize ChargeCard, SendThankYou, FulfillOrder
end
```
## Contributions
Interactor Rails is open source and contributions from the community are
encouraged! No contribution is too small.
See Interactor Rails'
[contribution guidelines](CONTRIBUTING.md) for more information.
## Thank You!
A very special thank you to [Attila Domokos](https://github.com/adomokos) for
his fantastic work on [LightService](https://github.com/adomokos/light-service).
Interactor is inspired heavily by the concepts put to code by Attila.