event_sourced_record 0.2.1 → 0.2.2

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: 06ccf236289151dabd66b3925bc7b9bf22cf7dd2
4
- data.tar.gz: ce90698ff8af4dfc5c9fb930af2044b5711dc7dd
3
+ metadata.gz: 692e2ac95eb36d3bd1829e4d168ad4fd1190cea4
4
+ data.tar.gz: c9774d305184fcdaecfe125cd9917fb218938d94
5
5
  SHA512:
6
- metadata.gz: d75a707b3c1cbf8c2f54a188895d6be623119a3dd874650cb95dd86d3a659bb5e0300de769bf85994cd037f387b90a2a7c942afbcd8eb56ca9d91bbed4578500
7
- data.tar.gz: d23d90630fa9cbbd3419dcf6f259055aabbdbcba9d58db029ddf95fae93d033972d34e210fe03a2cc5f68b97de66eab482ade464157dcd57fbff81679bf8ea76
6
+ metadata.gz: 55a60d577b5200e0ea6be2f4ba1b9cf78d9aa4e316289ac45692a0e86bb9c0c309258e4d7cad56a635b4b405cc85bc78eb711dcbbc30e356f083b80c0c3c857b
7
+ data.tar.gz: 2d0c9c72f643b515a764bb381dd97651193385adc7c617043a4a944a79de07ecf4cbe2ccd664a158e24ef2656bc7b6903248feec95495298a983d73f71d9d2fa
data/Getting_Started.md CHANGED
@@ -147,6 +147,9 @@ event_type :creation do
147
147
  validates :user_id, presence: true
148
148
  end
149
149
  ```
150
+
151
+ > If you are using mass-assignment protection, which is on by default in Rails 3.2, you may want to make these attributes mass-assignable with `attr_accessible`.
152
+
150
153
  This lets you build and save events with the attributes `bottles_per_shipment`,
151
154
  `bottles_purchased`, and `user_id`, and validates those attributes -- as long as the event type is set by using the auto-generated scope:
152
155
 
data/README.md CHANGED
@@ -68,6 +68,8 @@ The event model is an ActiveRecord model but it can act significantly different
68
68
  validates :bottles_per_shipment, numericality: true
69
69
  end
70
70
  end
71
+
72
+ > If you are using mass-assignment protection, which is on by default in Rails 3.2, you may want to make these attributes mass-assignable with `attr_accessible`.
71
73
 
72
74
  The easiest way to create these records is with the scopes that are automatically generated by `event_type`:
73
75
 
@@ -1,3 +1,3 @@
1
1
  module EventSourcedRecord
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -4,11 +4,13 @@ class <%= projection_migration_class_name %> < ActiveRecord::Migration
4
4
  <% attributes.each do |attribute| -%>
5
5
  t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
6
6
  <% end -%>
7
+ t.string :uuid
7
8
  t.timestamps
8
9
  end
9
10
  <% attributes_with_index.each do |attribute| -%>
10
11
  add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
11
12
  <% end -%>
13
+ add_index :<%= table_name %>, :uuid, :unique => true
12
14
  end
13
15
  end
14
16
 
@@ -30,7 +30,9 @@ class EventSourcedRecord::ProjectionGeneratorTest < Rails::Generators::TestCase
30
30
  else
31
31
  assert_migration("db/migrate/create_subscriptions.rb") do |contents|
32
32
  assert_match(/t.integer :user_id/, contents)
33
+ assert_match(/t.string :uuid/, contents)
33
34
  assert_match(/t.timestamps/, contents)
35
+ assert_match(/add_index :\w*, :uuid, :unique => true/, contents)
34
36
  end
35
37
  end
36
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_sourced_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francis Hwang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-04 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel