45 lines
1.1 KiB
Markdown
45 lines
1.1 KiB
Markdown
# Dunlop::Ember
|
|
This gem adds some context and support for connection ember applications
|
|
## baic assumptions (for now (infrastructure is growing))
|
|
* The model structure is non namespaced with `api`
|
|
* The controllers have namespace `Api`, not versioned (controller level) api (yet):
|
|
```ruby
|
|
namespace :api, path: 'api/v1' do
|
|
# ...api controller definitions...
|
|
end
|
|
```
|
|
* The inheritance column for STI models is `sti_type` in stead of the
|
|
inconvenient chosen `type`:
|
|
```ruby
|
|
class ApplicationRecord < ActiveRecord::Base
|
|
self.abstract_class = true
|
|
self.inheritance_column = :sti_type
|
|
end
|
|
```
|
|
* There is a UserSerializer in the main_app, can be same as `Api::User`
|
|
serializer `app/serializers/user_serializer.rb`:
|
|
```ruby
|
|
class UserSerializer < Api::UserSerializer
|
|
# attribute :email
|
|
# attribute :nickname
|
|
end
|
|
```
|
|
|
|
|
|
## Installation
|
|
Add this line to your application's Gemfile:
|
|
|
|
```ruby
|
|
gem 'dunlop-ember'
|
|
```
|
|
|
|
And then execute:
|
|
```bash
|
|
$ bundle
|
|
```
|
|
|
|
Add the engine to your routes file
|
|
```ruby
|
|
mount Dunlop::Ember::Engine => '/app'
|
|
```
|