tramway 0.4.6 → 0.4.7

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: 57af927fcbb72fd669c6c8b7f480c37b3a83abe44cd84cf9fbabcb2cfa842786
4
- data.tar.gz: ed23bd825f9bb892302f446366ad26420a84c0512af4627c5dd24fd239de7feb
3
+ metadata.gz: 69d16412bfd7e8fcb33e3ddc27a8be714350cd7fe97a56451a47dced641546c7
4
+ data.tar.gz: 60d32317870e16a0e4aadc618a8a2170939fda2e7d06d7202935a40d1ee945f7
5
5
  SHA512:
6
- metadata.gz: 0ed0b00d4f70aa52fa11299c274467e04ecd4070d9cad5ef63befe2c380186e24d13a9c7545faee0178587085f129b0af3c5f1e7376f66dea2bccf3219382c6f
7
- data.tar.gz: 8862017bcd151691898293a7c4756138601ac8fd89ae6f4509024c3448c2740451e956f0ebfe83a6f42890ea1fcbfbf61a55afb6d5101b8b17cbe7dd5acf8efa
6
+ metadata.gz: a31a8b31885e7bf84aed5896850e7e98930fcf7bdf5dcc74eaf006172b7d6f305458f79c659618ac8da82d2050d18b818a891ac93ef1ff4bf01a5fe20cf8dabc
7
+ data.tar.gz: f21ecdb0d87afb50afae3c3b5a01d953f3736778fad9f0e47e2b16e8a1d35b33002ef4bf96b1624af20e2aaa619d90c7195b1ed225bad68279e211dbf795f6f7
data/README.md CHANGED
@@ -18,6 +18,12 @@ gem "tramway"
18
18
  gem "view_component"
19
19
  ```
20
20
 
21
+ OR
22
+
23
+ ```shell
24
+ bundle add tramway view_component
25
+ ```
26
+
21
27
  ## Usage
22
28
 
23
29
  ### Tramway Entities
@@ -322,7 +328,21 @@ class UserForm < Tramway::BaseForm
322
328
  end
323
329
  ```
324
330
 
325
- #### Update and Destroy
331
+ ### Assign values
332
+
333
+ Tramway Form provides `assign` method that allows to assign values without saving
334
+
335
+ ```ruby
336
+ class UsersController < ApplicationController
337
+ def update
338
+ @user = tramway_form User.new
339
+ @user.assign params[:user] # assigns values to the form object
340
+ @user.reload # restores previous values
341
+ end
342
+ end
343
+ ```
344
+
345
+ ### Update and Destroy
326
346
 
327
347
  Read [behave_as_ar](https://github.com/Purple-Magic/tramway#behave_as_ar) section
328
348
 
@@ -45,6 +45,10 @@ module Tramway
45
45
  end
46
46
  end
47
47
 
48
+ def assign(params)
49
+ __submit params
50
+ end
51
+
48
52
  def method_missing(method_name, *args)
49
53
  if method_name.to_s.end_with?('=') && args.count == 1
50
54
  object.public_send(method_name, args.first)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.4.6'
4
+ VERSION = '0.4.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-05-20 00:00:00.000000000 Z
12
+ date: 2024-07-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-struct