tramway-admin 1.32.1.3 → 1.32.1.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12f18ece55fa0e66275d0ace0972d67490dc5396d7003f0ea0f24ab89d3e1be8
|
4
|
+
data.tar.gz: 4288cb1d7368b94747ddb238ece0024fca1e6f306a45aaf7c38a8e097b37ecf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65a7acba188612cc40301ff7949a4ecd5087154e7ecab8e4d8c9f366a56d2e9d043f3ad17d6e1cb9ac252e60615975a5c71b68f146bdf62edd9ef742d329baf1
|
7
|
+
data.tar.gz: 4cd7656172be3b226933b5fc81bb995aef736ba49488398f9680723ebe905954b73bd185765b40b0151cfce42817faac6e8c81f7a03d878e27761fdf9f26ea2f
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Tramway::Admin
|
1
|
+
# ![tramway-ico](https://raw.githubusercontent.com/kalashnikovisme/kalashnikovisme/master/%D1%82%D1%80%D1%8D%D0%BC%D0%B2%D1%8D%D0%B9%D0%B1%D0%B5%D0%B7%D1%84%D0%BE%D0%BD%D0%B0-min.png) Tramway::Admin
|
2
2
|
|
3
3
|
Create admin panel for your application FAST!
|
4
4
|
|
@@ -255,6 +255,35 @@ Here docs about changing roles of `Tramway::User::User` model [Readme](https://g
|
|
255
255
|
|
256
256
|
## Associations management
|
257
257
|
|
258
|
+
### has_many
|
259
|
+
|
260
|
+
We have models Game and Packs.
|
261
|
+
|
262
|
+
*app/models/game.rb*
|
263
|
+
```ruby
|
264
|
+
class Game < Tramway::Core::ApplicationRecord
|
265
|
+
has_many :packs
|
266
|
+
end
|
267
|
+
```
|
268
|
+
|
269
|
+
*app/models/pack.rb*
|
270
|
+
```ruby
|
271
|
+
class Pack < Tramway::Core::ApplicationRecord
|
272
|
+
belongs_to :game
|
273
|
+
end
|
274
|
+
```
|
275
|
+
|
276
|
+
**You want to manage packs in the Game show admin page**
|
277
|
+
|
278
|
+
#### 1. Add association to PackDecorator
|
279
|
+
|
280
|
+
*app/decorators/pack_decorator.rb*
|
281
|
+
```ruby
|
282
|
+
class GameDecorator < Tramway::Core::ApplicationDecorator
|
283
|
+
decorate_association :packs, as: :game # we recommend you to add association name in Pack model. You need it if association name of Game in Pack is not `game`
|
284
|
+
end
|
285
|
+
```
|
286
|
+
|
258
287
|
### has_and_belongs_to_many
|
259
288
|
|
260
289
|
We have models Game and Packs.
|
@@ -14,3 +14,6 @@
|
|
14
14
|
= hidden_field_tag :redirect, params[:redirect]
|
15
15
|
= f.button :submit, t('helpers.links.save'), class: 'btn-success'
|
16
16
|
= link_to t('helpers.links.back'), current_model_records_path, class: 'btn btn-secondary'
|
17
|
+
|
18
|
+
-# NOTES
|
19
|
+
-# * value_from_params helper is in tramway-core gem app/helpers/inputs_helpers.rb
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.32.1.
|
4
|
+
version: 1.32.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tramway-core
|