Sha256: a0c24816861f2e25e4629fcc356e0c0cbd981c38831cd497273ff71e7bbe1478

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

# Creating an ORM adapter

To use SecondStep with a orm other then ActiveRecord, you'll need to create an
orm.

The orm should have a class for each model, implementing attributes and
relations for each model. All models are stored in </lib/second_step/models> as
an ActiveSupport::Concern. When creating a class to wrap the model, you should
include the concern. There is a comment on each model listing what an orm
implementation must provide. You can look at the memory and active_record
adapters to see an example of how to implement a model.

```ruby
# ORM implementation:
#
# Attributes: token
# Belongs to: application_user
```

Once you finish that, package your adapter in a module. If chosen as the orm to
use, it will be included into `SecondStep`. Make sure not to override any
SecondStep classes.

Now, register your adapter with SecondStep. This must be done before SecondStep
is configured.

```ruby
SecondStep.register_orm_adapter your_adapter_name: 'Name::Of::AdapterModule'
```

A user can chose to use your adapter by changing this line in their config to:
```ruby
orm_adapter :your_adapter_name
```

Version data entries

5 entries across 4 versions & 1 rubygems

Version Path
second_step-0.2.0 docs/creating_an_adapter.md
second_step-0.1.4 docs/creating_an_adapter.md
second_step-0.1.3 docs/creating_an_adapter.md
second_step-0.1.2 docs/creating_an_adapter.md
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/second_step-0.1.1/docs/creating_an_adapter.md