event_attribute 1.0.0 → 1.0.1

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: fa4d4630a70af28e5ad77263e2eb85dceaf75371
4
- data.tar.gz: 407b01afebb42217079da76e330cfaa12cc1eea3
3
+ metadata.gz: b40fa05c1b336762c61738470e8dcfd0f37a381b
4
+ data.tar.gz: 4853cda282d917d26122199d22f6cd63b71ed614
5
5
  SHA512:
6
- metadata.gz: 30a39c9fde9a2ccb85c6aadfdad910948f2923614015e28131b804c7c90844d72c06af450ff9ebf5e41a1efd8da37f6f3c0651bd4e1dce2751817f0ec6f004bf
7
- data.tar.gz: 0f3c5d861ed4bdcf74d2cd8667c8254b19ede23bb191848dae045a727105f9880d5ce7dda9982b0c0788f360ee41fdc18c30fc7390f636dd08b108fbef0f6f1d
6
+ metadata.gz: ca504634fe19194dcf25b090cf3d9f90935d7ddbb1cda7c70fd3039e3e59796e2168f82ec8b152289bfb140ca89e78c4873875f7f06ba0c2f5998003dc22af65
7
+ data.tar.gz: 0d60627d8e7707eaf9f1504cf1d16fcf82dcb5d54dfa38d893d5233ef947f512450a1b8ba27b5480098d396699ad1d155db975b33cb4f3d27acd359791fb695e
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
- *.db
1
+ Gemfile.lock
2
+ pkg
2
3
  test/*.log
4
+ *.db
data/README.md CHANGED
@@ -20,24 +20,27 @@ Or install it yourself as:
20
20
  ## Usage
21
21
 
22
22
  ```ruby
23
- class Referral < ActiveRecord::Base
24
- event_attribute :applied_at, :attribute => 'pending', :nil_equals => true
25
- event_attribute :subscribed_on
26
- end
27
-
28
- referral = Referral.create(:applied_at => Time.now)
29
- referral.pending? # => false
30
- referral.subscribed? # => false
31
-
32
- referral.pending = true
33
- referral.applied_at # => nil
34
- referral.pending? # => true
35
-
36
- referral.subscribed = true
37
- referral.subscribed_on # => Time.now
38
- referral.subscribed? # => true
23
+ class Referral < ActiveRecord::Base
24
+ event_attribute :applied_at, :attribute => 'pending', :nil_equals => true
25
+ event_attribute :subscribed_on
26
+ end
27
+
28
+ referral = Referral.create(:applied_at => Time.now)
29
+ referral.pending? # => false
30
+ referral.subscribed? # => false
31
+
32
+ referral.pending = true
33
+ referral.applied_at # => nil
34
+ referral.pending? # => true
35
+
36
+ referral.subscribed = true
37
+ referral.subscribed_on # => Date.today
38
+ referral.subscribed? # => true
39
39
  ```
40
40
 
41
+ In this example, subscribed_on is defined in the schema as being a Date type column, and applied_at is defined in the schema as being a DateTime.
42
+
43
+
41
44
  ## Contributing
42
45
 
43
46
  1. Fork it
@@ -10,12 +10,11 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["chris@prx.org"]
11
11
  spec.description = %q{EventAttribute allows you to turn your date/datetime columns in to boolean attributes in ActiveRecord.}
12
12
  spec.summary = %q{Idea for this was taken from http://jamis.jamisbuck.org/articles/2005/12/14/two-tips-for-working-with-databases-in-rails}
13
- spec.homepage = ""
13
+ spec.homepage = "http://github.com/PRX/event_attribute"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.test_files = spec.files.grep(%r{^test/})
19
18
  spec.require_paths = ["lib"]
20
19
  spec.add_dependency "activesupport", ">= 3.0.0"
21
20
 
@@ -1,3 +1,3 @@
1
1
  module EventAttribute
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_attribute
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Younger
@@ -106,10 +106,8 @@ extra_rdoc_files: []
106
106
  files:
107
107
  - .gitignore
108
108
  - Gemfile
109
- - Gemfile.lock
110
109
  - LICENSE.txt
111
110
  - README.md
112
- - RUNNING_UNIT_TESTS
113
111
  - Rakefile
114
112
  - event_attribute.gemspec
115
113
  - lib/event_attribute.rb
@@ -118,7 +116,7 @@ files:
118
116
  - test/database.yml
119
117
  - test/event_attribute_test.rb
120
118
  - test/schema.rb
121
- homepage: ''
119
+ homepage: http://github.com/PRX/event_attribute
122
120
  licenses:
123
121
  - MIT
124
122
  metadata: {}
@@ -1,47 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- event_attribute (1.0.0)
5
- activesupport (>= 3.0.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activemodel (4.0.0)
11
- activesupport (= 4.0.0)
12
- builder (~> 3.1.0)
13
- activerecord (4.0.0)
14
- activemodel (= 4.0.0)
15
- activerecord-deprecated_finders (~> 1.0.2)
16
- activesupport (= 4.0.0)
17
- arel (~> 4.0.0)
18
- activerecord-deprecated_finders (1.0.3)
19
- activesupport (4.0.0)
20
- i18n (~> 0.6, >= 0.6.4)
21
- minitest (~> 4.2)
22
- multi_json (~> 1.3)
23
- thread_safe (~> 0.1)
24
- tzinfo (~> 0.3.37)
25
- arel (4.0.0)
26
- atomic (1.1.10)
27
- builder (3.1.4)
28
- i18n (0.6.4)
29
- minitest (4.7.5)
30
- multi_json (1.7.7)
31
- mysql2 (0.3.11)
32
- rake (10.1.0)
33
- sqlite3 (1.3.7)
34
- thread_safe (0.1.0)
35
- atomic
36
- tzinfo (0.3.37)
37
-
38
- PLATFORMS
39
- ruby
40
-
41
- DEPENDENCIES
42
- activerecord
43
- bundler (~> 1.3)
44
- event_attribute!
45
- mysql2
46
- rake
47
- sqlite3
@@ -1,42 +0,0 @@
1
- == Creating the test database
2
-
3
- The default name for the test databases is "event_attribute_plugin_test". If you
4
- want to use another database name then be sure to update the connection
5
- adapter setups you want to test with in test/database.yml.
6
-
7
- Make sure that you create database objects with the same user that you specified in
8
- database.yml otherwise (on Postgres, at least) tests for default values will fail.
9
-
10
- == Running with Rake
11
-
12
- The easiest way to run the unit tests is through Rake. The default task runs
13
- the entire test suite for the sqlite3 adapter. You can also run the suite on just
14
- one adapter by passing the DB environment variable.
15
-
16
- rake test DB=mysql
17
-
18
- For more information, checkout the full array of rake tasks with "rake -T"
19
-
20
- Rake can be found at http://rake.rubyforge.org
21
-
22
- == Running by hand
23
-
24
- Unit tests are located in test directory. If you only want to run a single test suite,
25
- or don't want to bother with Rake, you can do so with something like:
26
-
27
- cd test; DB=mysql ruby base_test.rb
28
-
29
- That'll run the base suite using the MySQL adapter. Change the adapter
30
- and test suite name as needed.
31
-
32
- == Faster tests
33
-
34
- If you are using a database that supports transactions, you can set the
35
- "AR_TX_FIXTURES" environment variable to "yes" to use transactional fixtures.
36
- This gives a very large speed boost. With rake:
37
-
38
- rake AR_TX_FIXTURES=yes
39
-
40
- Or, by hand:
41
-
42
- AR_TX_FIXTURES=yes ruby -I connections/native_sqlite3 base_test.rb