soulless 0.5.0.rc4 → 0.5.0.rc5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73404dc7c4d37dd5d37a9e9da0b1cbcf4ab270d7
4
- data.tar.gz: 3f96ef0fb6469f40839715f5e47694e1ea2a6f0d
3
+ metadata.gz: 55f2a96f9a0f18a43db7ff06832033aa57bdb84d
4
+ data.tar.gz: b5dd5bae30504bfb5c17aff8b9745a0142985923
5
5
  SHA512:
6
- metadata.gz: dd7cb188a6bd2073b7800be185d4dfff1fb8a80d906ee8efb6e26aefe2cf9e34a252e7834f1f9cab353297b4f5f69fd1a401aa62a064b243d3f8cd480791f7cc
7
- data.tar.gz: 326844e42ebe27522d559ceac30e75357ed362f2cd15395f3632e5ca6dcd7fd6157cc65a7d11f4aad6a668618b17c887d37f4e93163916d765c2f3e5ef842ad5
6
+ metadata.gz: be0ba0bb958e7049229b0bdd6d0c583e7d2784b9f767ac7e6ff9f3499231c88f8cc25a172d1bdc39d1af968d89ad5b534e9577fe2c83b5862d3804d5626e8e9e
7
+ data.tar.gz: 9fb3d78389ba6974ad8ff60e6096cfc3efd660eb37f6bb023c8def6d72decbebe5f7bd9f8e013f8889b36052b3031283103026c0fdf7dd3a927d7ec1767e2e88
data/README.md CHANGED
@@ -331,7 +331,7 @@ form.errors.messages # => { name: ["can't be blank"] }
331
331
 
332
332
  ```additional_attributes``` - Used to specify attributes that cannot automatically be added to the form model. These are generally attributes that have been specified using ```attr_accessor```. Accepts a string, symbol or an array of strings and symbols for multiple attributes.
333
333
 
334
- ```validate_attribute_on``` - By default any validation that specifies an ```:on``` option will not be inherited. This option will allow you to inherit a validator that uses the ```:on``` with a specific value. Example usage: ```validate_password_on: :create`. Accepts a string or symbol. This option will accept any value that the Rails ```:on``` validator option can accept.
334
+ ```validate_attribute_on``` - By default any validation that specifies an ```:on``` option will not be inherited. This option will allow you to inherit a validator that uses the ```:on``` with a specific value. Example usage: ```validate_password_on: :create```. Accepts a string or symbol. This option will accept any value that the Rails ```:on``` validator option can accept.
335
335
 
336
336
  ### I18n
337
337
 
@@ -344,8 +344,9 @@ en:
344
344
  errors:
345
345
  models:
346
346
  person:
347
- name:
348
- blank: "there's nothing here"
347
+ attributes:
348
+ name:
349
+ blank: "there's nothing here"
349
350
  ```
350
351
 
351
352
  For attributes defined as ```has_one``` and ```has_many``` associations use the enclosing class as the locale key's namespace.
@@ -356,8 +357,9 @@ en:
356
357
  errors:
357
358
  models:
358
359
  person/spouse:
359
- name:
360
- blank: "there's nothing here"
360
+ attributes:
361
+ name:
362
+ blank: "there's nothing here"
361
363
  ```
362
364
 
363
365
  ## Contributing
@@ -33,9 +33,13 @@ module Soulless
33
33
  false
34
34
  end
35
35
  end
36
+
37
+ def assign_attributes(attributes)
38
+ deep_update(self, attributes)
39
+ end
36
40
 
37
41
  def update_attributes(attributes)
38
- deep_update(self, attributes)
42
+ assign_attributes(attributes)
39
43
  save
40
44
  end
41
45
 
@@ -1,3 +1,3 @@
1
1
  module Soulless
2
- VERSION = "0.5.0.rc4"
2
+ VERSION = "0.5.0.rc5"
3
3
  end
@@ -27,26 +27,29 @@ describe Soulless do
27
27
  @dummy_class.saved.should be_false
28
28
  end
29
29
 
30
- it '#update_attributes should update multiple attributes and then save' do
31
- @dummy_class.update_attributes(name: 'Yaw', email: 'yokoono@thebeatles.com')
32
- @dummy_class.name.should == 'Yaw'
33
- @dummy_class.email.should == 'yokoono@thebeatles.com'
34
- @dummy_class.saved?.should be_true
30
+ it '#update_attributes should not save' do
31
+ @dummy_class.assign_attributes(name: 'Yaw', email: 'yokoono@thebeatles.com')
32
+ @dummy_class.saved?.should be_false
35
33
  end
36
34
 
37
- it '#update_attributes should merge new values' do
35
+ it '#assign_attributes should merge new values' do
38
36
  @dummy_class.email = 'yokoono@thebeatles.com'
39
- @dummy_class.update_attributes(name: 'Yaw')
37
+ @dummy_class.assign_attributes(name: 'Yaw')
40
38
  @dummy_class.name.should == 'Yaw'
41
39
  @dummy_class.email.should == 'yokoono@thebeatles.com'
42
40
  end
43
41
 
44
- it '#update_attributes should deep merge new values' do
42
+ it '#assign_attributes should deep merge new values' do
45
43
  @dummy_class = DummyAssociation.new(spouse: { name: 'Megan' })
46
- @dummy_class.update_attributes(spouse: { name: 'Mary Jane Watson' })
44
+ @dummy_class.assign_attributes(spouse: { name: 'Mary Jane Watson' })
47
45
  @dummy_class.spouse.name.should == 'Mary Jane Watson'
48
46
  end
49
47
 
48
+ it '#update_attributes should save' do
49
+ @dummy_class.update_attributes(name: 'Yaw', email: 'yokoono@thebeatles.com')
50
+ @dummy_class.saved?.should be_true
51
+ end
52
+
50
53
  it '#persisted? should be false' do
51
54
  @dummy_class.persisted?.should be_false
52
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soulless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.rc4
4
+ version: 0.5.0.rc5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-13 00:00:00.000000000 Z
11
+ date: 2014-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport