active_record_attributes_equality 1.0.0.rc → 1.0.0.rc.2
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.
- data/README.md +29 -12
- metadata +3 -2
data/README.md
CHANGED
@@ -1,31 +1,48 @@
|
|
1
|
-
|
1
|
+
### Introduction
|
2
2
|
|
3
3
|
Active Record Attributes Equality is a very simple rails plugin / gem that forces ActiveRecord to compare the mode's attributes in the presence of two new records.
|
4
4
|
|
5
5
|
|
6
|
-
|
6
|
+
### Example
|
7
7
|
|
8
8
|
Consider a User model that holds the notion of users that have a name.
|
9
9
|
|
10
|
-
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
10
|
+
<pre>
|
11
|
+
# create_table(:user, :force => true) do |t|
|
12
|
+
# t.string :name, null => false
|
13
|
+
# end
|
14
|
+
class User < ActiveRecord::Base; end
|
14
15
|
|
15
|
-
Default ActiveRecord behavior:
|
16
|
+
Default ActiveRecord behavior:
|
16
17
|
|
17
|
-
User.new(:name => "John") == User.new(:name => "John") #=> false
|
18
|
+
User.new(:name => "John") == User.new(:name => "John") #=> false
|
18
19
|
|
19
|
-
Introduce ActiveRecordAttributesEquality and that same instruction will return true:
|
20
|
+
Introduce ActiveRecordAttributesEquality and that same instruction will return true:
|
20
21
|
|
21
|
-
User.new(:name => "John") == User.new(:name => "John") #=> true
|
22
|
+
User.new(:name => "John") == User.new(:name => "John") #=> true
|
23
|
+
</pre>
|
22
24
|
|
23
25
|
|
24
|
-
|
26
|
+
### Installing
|
27
|
+
|
28
|
+
#### As a gem (using bundler)
|
29
|
+
|
30
|
+
<pre>
|
31
|
+
gem "active_record_attributes_equality"
|
32
|
+
</pre>
|
33
|
+
|
34
|
+
#### As a Rails 3 plugin
|
35
|
+
|
36
|
+
<pre>
|
37
|
+
rails rails plugin install git@github.com:GnomesLab/active_record_attributes_equality.git
|
38
|
+
</pre>
|
39
|
+
|
40
|
+
|
41
|
+
### Feedback, questions, improvements, critics or just say hi
|
25
42
|
|
26
43
|
Feel free to fork the project and to send pull requests with your changes. Should you run into problems, please use the issue tracker made available in this Github project.
|
27
44
|
|
28
45
|
|
29
|
-
|
46
|
+
### License
|
30
47
|
|
31
48
|
Copyright (c) 2010 Gnomeslab, released under the MIT license. For more information regarding this license type please check the MIT-LICENSE file.
|
metadata
CHANGED
@@ -7,7 +7,8 @@ version: !ruby/object:Gem::Version
|
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- rc
|
10
|
-
|
10
|
+
- 2
|
11
|
+
version: 1.0.0.rc.2
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Diogo Almeida
|
@@ -34,7 +35,7 @@ dependencies:
|
|
34
35
|
version: 3.0.0.rc
|
35
36
|
type: :runtime
|
36
37
|
version_requirements: *id001
|
37
|
-
description: Active Record Attributes Equality is a very simple rails plugin / gem that forces ActiveRecord to compare the
|
38
|
+
description: Active Record Attributes Equality is a very simple rails plugin / gem that forces ActiveRecord to compare the model's attributes in the presence of two new records. Otherwise, it fallsback to ActiveRecord::Base#==.
|
38
39
|
email:
|
39
40
|
- diogo.almeida@gnomeslab.com
|
40
41
|
executables: []
|