rails_metadata 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 084ee18887c21e25caac6e07614d1fe9196748b4
4
- data.tar.gz: db5578b6f8f54823e44b89d30eaf02c54eb8cfb7
3
+ metadata.gz: 1d70c4718bb870c6bd0de9799148db4d1792afc0
4
+ data.tar.gz: dfb7b2903774eb0c64e12c6331a51dc0099f2f81
5
5
  SHA512:
6
- metadata.gz: a72c957d8bce64a33c0db8edf02ce9d6b4e58485d46370beec5864d08bcc3f871bea3fd7435dffd273edda2c8a22ff5af01d7c242783b0090682ca5117e33b48
7
- data.tar.gz: cef7076850762436e4664cb94931c3b600fcb93afd66d9426eac72a44a18a63fb6d1ad9448eadf1b63fcd5f1a05f696c8874a9493c32d92f596dce5dad623778
6
+ metadata.gz: ca7741953af6e127e6925831a5136b205cd6ccf093cc4a77d534bcd6112f62bdc30f1d2c27ed11c61c0d2644b583fa364ac558d5631dbf54e75a7a1647f1defd
7
+ data.tar.gz: fcd9ba1a7ee8e0a0656757b6d60485bc147d3b9eaac52ae6e70f5e0d5794a3083060343e0f8fe9f3a5d3143b1485efe76f888dbad03fadb7bf6f51648a57d7b1
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # RailsMetadata
2
2
 
3
- TODO: Write a gem description
3
+ For adding fake fields stored in a hash in Rails.
4
+
5
+ More documentation to come when I'm less lazy.
4
6
 
5
7
  ## Installation
6
8
 
@@ -18,7 +20,18 @@ Or install it yourself as:
18
20
 
19
21
  ## Usage
20
22
 
21
- TODO: Write usage instructions here
23
+ For any model you want to use this on, add the following.
24
+ ```
25
+ include RailsMetadata
26
+ serializable :metadata, Hash
27
+ ```
28
+ And perform the following migration
29
+ ```
30
+ add_column :table_name, :metadata, :text
31
+ ```
32
+
33
+ The default limit on :text fields is 65535, so if you anticipate storing more
34
+ than that, you should set the limit higher on the column.
22
35
 
23
36
  ## Contributing
24
37
 
@@ -1,3 +1,3 @@
1
1
  module RailsMetadata
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -13,7 +13,7 @@ module RailsMetadata
13
13
  end
14
14
  typecast = case type
15
15
  when nil then val
16
- when :boolean then lambda { |v| v.is_a?(String) ? v.empty? : !!v }
16
+ when :boolean then lambda { |v| v.is_a?(String) ? !v.empty? : !!v }
17
17
  when :string then lambda { |v| v.to_s }
18
18
  when :integer then lambda { |v| v.to_i }
19
19
  when :float then lambda { |v| v.to_f }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Neyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-28 00:00:00.000000000 Z
11
+ date: 2013-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler