active_record_ignored_attributes 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -61,7 +61,7 @@ Installing
61
61
  Add to your `Gemfile`:
62
62
 
63
63
  <pre>
64
- gem "active_record_attributes_equality"
64
+ gem "active_record_ignored_attributes"
65
65
  </pre>
66
66
 
67
67
  If you want to *replace* the default ActiveRecord `==` operator with the `same_as?` behavior, you should be able to just override it, like this:
@@ -73,7 +73,7 @@ If you want to *replace* the default ActiveRecord `==` operator with the `same_a
73
73
  Configuring which attributes are ignored
74
74
  ========================================
75
75
 
76
- By default, `id`, `created_at`, and `updated_at` will be ignored.
76
+ By default, `id`, `created_at`, and `updated_at` will be ignored (`id` is *not* ignored by `inspect_without_ignored_attributes` though).
77
77
 
78
78
  If you want to *add* some ignored attributes to the default array (`[:id, :created_at, :updated_at]`), you can override `self.ignored_attributes` like so, referencing `super`:
79
79
 
@@ -134,6 +134,20 @@ or:
134
134
  end
135
135
  end
136
136
 
137
+ If you want to inspect with the same attributes as inspect_without_ignored_attributes plus some
138
+ *additional* attributes (or, more likely, some virtual attributes), you can just use the
139
+ `attributes_for_inspect` method that `inspect_without_ignored_attributes` uses, which automatically
140
+ excludes any attributes listed in `ignored_attributes`:
141
+
142
+ class Address < ActiveRecord::Base
143
+ def inspect
144
+ inspect_with(attributes_for_inspect + [:virtual_attr_1, :virtual_attr_2])
145
+ end
146
+ end
147
+
148
+ This is useful because virtual attributes (methods in your model that aren't part of the
149
+ "attributes" returned by record.attributes) won't be included by inspect_without_ignored_attributes
150
+ by default.
137
151
 
138
152
  RSpec
139
153
  =======
@@ -4,7 +4,7 @@ require "active_record_ignored_attributes/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "active_record_ignored_attributes"
7
- s.version = ActiveRecordIgnoredAttributes::Version
7
+ s.version = ActiveRecordIgnoredAttributes.version
8
8
  s.authors = ["Tyler Rick"]
9
9
  s.email = ["tyler@tylerrick.com"]
10
10
  s.homepage = ""
@@ -1,3 +1,5 @@
1
1
  module ActiveRecordIgnoredAttributes
2
- Version = "0.0.3"
2
+ def self.version
3
+ "0.0.4"
4
+ end
3
5
  end
metadata CHANGED
@@ -1,116 +1,113 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: active_record_ignored_attributes
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
4
5
  prerelease:
5
- version: 0.0.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Tyler Rick
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-09-07 00:00:00 -07:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: activerecord
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &14080760 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: facets
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *14080760
25
+ - !ruby/object:Gem::Dependency
26
+ name: facets
27
+ requirement: &14079980 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
36
33
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: rspec
40
34
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *14079980
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &14095640 !ruby/object:Gem::Requirement
42
39
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
47
44
  type: :development
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: sqlite3
51
45
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *14095640
47
+ - !ruby/object:Gem::Dependency
48
+ name: sqlite3
49
+ requirement: &14094940 !ruby/object:Gem::Requirement
53
50
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
58
55
  type: :development
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: mysql2
62
56
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *14094940
58
+ - !ruby/object:Gem::Dependency
59
+ name: mysql2
60
+ requirement: &14094320 !ruby/object:Gem::Requirement
64
61
  none: false
65
- requirements:
62
+ requirements:
66
63
  - - ~>
67
- - !ruby/object:Gem::Version
64
+ - !ruby/object:Gem::Version
68
65
  version: 0.2.11
69
66
  type: :development
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: rr
73
67
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *14094320
69
+ - !ruby/object:Gem::Dependency
70
+ name: rr
71
+ requirement: &14093860 !ruby/object:Gem::Requirement
75
72
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
80
77
  type: :development
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
83
- name: activesupport
84
78
  prerelease: false
85
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *14093860
80
+ - !ruby/object:Gem::Dependency
81
+ name: activesupport
82
+ requirement: &14093300 !ruby/object:Gem::Requirement
86
83
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: "0"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
91
88
  type: :development
92
- version_requirements: *id007
93
- - !ruby/object:Gem::Dependency
94
- name: ruby-debug19
95
89
  prerelease: false
96
- requirement: &id008 !ruby/object:Gem::Requirement
90
+ version_requirements: *14093300
91
+ - !ruby/object:Gem::Dependency
92
+ name: ruby-debug19
93
+ requirement: &14092880 !ruby/object:Gem::Requirement
97
94
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- version: "0"
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
102
99
  type: :development
103
- version_requirements: *id008
104
- description: Allows you to compare Active Record objects based on their *attributes* (with same_as?), to exclude some attributes from being used in comparison, and adds improved inspect method
105
- email:
100
+ prerelease: false
101
+ version_requirements: *14092880
102
+ description: Allows you to compare Active Record objects based on their *attributes*
103
+ (with same_as?), to exclude some attributes from being used in comparison, and adds
104
+ improved inspect method
105
+ email:
106
106
  - tyler@tylerrick.com
107
107
  executables: []
108
-
109
108
  extensions: []
110
-
111
109
  extra_rdoc_files: []
112
-
113
- files:
110
+ files:
114
111
  - .gitignore
115
112
  - .rspec
116
113
  - Gemfile
@@ -137,33 +134,31 @@ files:
137
134
  - spec/support/database.sqlite3.yml
138
135
  - spec/support/models/address.rb
139
136
  - spec/support/schema.rb
140
- has_rdoc: true
141
- homepage: ""
137
+ homepage: ''
142
138
  licenses: []
143
-
144
139
  post_install_message:
145
140
  rdoc_options: []
146
-
147
- require_paths:
141
+ require_paths:
148
142
  - lib
149
- required_ruby_version: !ruby/object:Gem::Requirement
143
+ required_ruby_version: !ruby/object:Gem::Requirement
150
144
  none: false
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- version: "0"
155
- required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
150
  none: false
157
- requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- version: "0"
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
161
155
  requirements: []
162
-
163
156
  rubyforge_project:
164
- rubygems_version: 1.5.2
157
+ rubygems_version: 1.8.15
165
158
  signing_key:
166
159
  specification_version: 3
167
- summary: Allows you to compare Active Record objects based on their *attributes* (with same_as?), to exclude some attributes from being used in comparison, and adds improved inspect method
160
+ summary: Allows you to compare Active Record objects based on their *attributes* (with
161
+ same_as?), to exclude some attributes from being used in comparison, and adds improved
162
+ inspect method
168
163
  test_files: []
169
-
164
+ has_rdoc: