active_hash 1.5.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +4 -0
- data/README.md +9 -29
- data/lib/active_file/base.rb +1 -1
- data/lib/active_file/multiple_files.rb +1 -1
- data/lib/active_hash/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 475fb352ab35cf436d135d74983e6ca7115c24a15d12681dd1176af36cea8cea
|
4
|
+
data.tar.gz: 98d31cd371ae7363e0c8e32ab7e7d87a3e2c74f1d4621456e17448be016a8c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9731e071b74c51753692d5e9d96144645cb314915ee8537666f1185fc23be109e3747c92bcbd68bcb429b9bf9564788694fb726d804ddb69354f0bcd93150a8
|
7
|
+
data.tar.gz: ce8d0eb87fea1909091dd01fc2f2afc20434f0fa22223777351880c6c8753fd4609d0784a001cfd1bfe194ed9a31d53bd24a49e867ece3b30545ffdec67b38d1
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
2018-02-27 (v2.0.0)
|
2
|
+
- Drop old Ruby and Rails support [#157](https://github.com/zilkey/active_hash/pull/157)
|
3
|
+
- Don't generate instance accessors for class attributes [#136](https://github.com/zilkey/active_hash/pull/136) Thanks, @rainhead
|
4
|
+
|
1
5
|
2017-06-14 (v1.5.3)
|
2
6
|
- Support symbol values in where and find_by [#156](https://github.com/zilkey/active_hash/pull/156) Thanks, @south37
|
3
7
|
|
data/README.md
CHANGED
@@ -25,6 +25,13 @@ Other:
|
|
25
25
|
```ruby
|
26
26
|
gem install active_hash
|
27
27
|
```
|
28
|
+
|
29
|
+
**Currently version 2.x doesn't support Ruby < 2.4 and Rails < 5**. If you use these versions, please use 1.x.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem 'active_hash', '~> 1.5.3'
|
33
|
+
```
|
34
|
+
|
28
35
|
## Reason for being
|
29
36
|
|
30
37
|
We wrote ActiveHash so that we could use simple, in-memory, ActiveRecord-like data structures that play well with Rails forms, like:
|
@@ -210,16 +217,6 @@ Country.delete_all # => does not affect the yaml files in any way - just clears
|
|
210
217
|
|
211
218
|
One common use case for ActiveHash is to have top-level objects in memory that ActiveRecord objects belong to.
|
212
219
|
|
213
|
-
In versions of ActiveRecord previous to 3.1, you should be able to do the following:
|
214
|
-
```ruby
|
215
|
-
class Country < ActiveHash::Base
|
216
|
-
end
|
217
|
-
|
218
|
-
class Person < ActiveRecord::Base
|
219
|
-
belongs_to :country
|
220
|
-
end
|
221
|
-
```
|
222
|
-
However, as of ActiveRecord 3.1 support for ActiveRecord's `belongs_to` is broken. Instead, you must extend ActiveHash::Associations::ActiveRecordExtensions method:
|
223
220
|
```ruby
|
224
221
|
class Country < ActiveHash::Base
|
225
222
|
end
|
@@ -242,21 +239,6 @@ class Person < ActiveRecord::Base
|
|
242
239
|
belongs_to_active_hash :country
|
243
240
|
end
|
244
241
|
```
|
245
|
-
With ActiveRecord versions < 3.1, ActiveHash will also work as a polymorphic parent:
|
246
|
-
```ruby
|
247
|
-
class Country < ActiveHash::Base
|
248
|
-
end
|
249
|
-
|
250
|
-
class Person < ActiveRecord::Base
|
251
|
-
belongs_to :location, :polymorphic => true
|
252
|
-
end
|
253
|
-
|
254
|
-
person = Person.new
|
255
|
-
person.location = Country.first
|
256
|
-
person.save
|
257
|
-
person.location # => Country.first
|
258
|
-
```
|
259
|
-
However, as of ActiveRecord 3.1 this will not work. If you need support for that, please open an issue.
|
260
242
|
|
261
243
|
### Using shortcuts
|
262
244
|
|
@@ -563,10 +545,8 @@ If your changes seem reasonable and the specs pass I'll give you commit rights t
|
|
563
545
|
|
564
546
|
To make users' lives easier, please maintain support for:
|
565
547
|
|
566
|
-
* Ruby
|
567
|
-
*
|
568
|
-
* Ruby 1.92
|
569
|
-
* ActiveRecord/ActiveSupport from 2.3.2 through edge
|
548
|
+
* Ruby 2.4
|
549
|
+
* ActiveRecord/ActiveSupport from 5.0 through edge
|
570
550
|
|
571
551
|
To that end, run specs against all rubies before committing:
|
572
552
|
|
data/lib/active_file/base.rb
CHANGED
@@ -4,7 +4,7 @@ module ActiveFile
|
|
4
4
|
extend ActiveFile::MultipleFiles
|
5
5
|
|
6
6
|
if respond_to?(:class_attribute)
|
7
|
-
class_attribute :filename, :root_path, :data_loaded
|
7
|
+
class_attribute :filename, :root_path, :data_loaded, instance_reader: false, instance_writer: false
|
8
8
|
else
|
9
9
|
class_inheritable_accessor :filename, :root_path, :data_loaded
|
10
10
|
end
|
data/lib/active_hash/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Dean
|
@@ -29,7 +29,7 @@ authors:
|
|
29
29
|
autorequire:
|
30
30
|
bindir: bin
|
31
31
|
cert_chain: []
|
32
|
-
date:
|
32
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: activesupport
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.7.3
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: An ActiveRecord-like model that uses a hash or file as a datasource
|