dirty_history 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.6.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "dirty_history"
8
- s.version = "0.5.4"
8
+ s.version = "0.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gavin Todes"]
12
- s.date = "2012-06-01"
12
+ s.date = "2012-06-15"
13
13
  s.description = "Dirty History is a simple gem that allows you to keep track of changes to specific fields in your Rails models using the ActiveRecord::Dirty module."
14
14
  s.email = "gavin.todes@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -2267,7 +2267,7 @@ Gem::Specification.new do |s|
2267
2267
  s.homepage = "http://github.com/GAV1N/dirty_history"
2268
2268
  s.licenses = ["MIT"]
2269
2269
  s.require_paths = ["lib"]
2270
- s.rubygems_version = "1.8.21"
2270
+ s.rubygems_version = "1.8.24"
2271
2271
  s.summary = "Easily keep track of changes to specific model fields."
2272
2272
 
2273
2273
  if s.respond_to? :specification_version then
@@ -4,11 +4,19 @@ class DirtyHistoryRecord < ActiveRecord::Base
4
4
 
5
5
  validates_presence_of :object_type, :object_id, :column_name, :column_type, :new_value
6
6
 
7
- scope :created_by, lambda { |creator| where(["dirty_history_records.creator_id = ? AND dirty_history_records.creator_type = ?", creator.id, creator.class.name]) }
8
- scope :not_created_by, lambda { |non_creator| where(["dirty_history_records.creator_id <> ? OR dirty_history_records.creator_type <> ?", non_creator.id, non_creator.class.name]) }
9
- scope :for_object_type, lambda { |object_type| where(:object_type => object_type.to_s.classify) }
10
- scope :for_attribute, lambda { |attribute| where(:column_name => attribute.to_s) }
11
-
7
+ scope :created_by, lambda { |creator| where(["dirty_history_records.creator_id = ? AND dirty_history_records.creator_type = ?", creator.id, creator.class.name]) }
8
+ scope :not_created_by, lambda { |non_creator| where(["dirty_history_records.creator_id <> ? OR dirty_history_records.creator_type <> ?", non_creator.id, non_creator.class.name]) }
9
+ scope :for_object_type, lambda { |object_type| where(:object_type => object_type.to_s.classify) }
10
+ scope :for_attribute, lambda { |attribute| where(:column_name => attribute.to_s) }
11
+ scope :created_in_range, lambda { |range| created_at_gte(range.first).created_at_lte(range.last) }
12
+ scope :created_at_gte, lambda { |date| created_at_lte_or_gte(date,"gte") }
13
+ scope :created_at_lte, lambda { |date| created_at_lte_or_gte(date,"lte") }
14
+ scope :created_at_lte_or_gte, lambda { |date, lte_or_gte|
15
+ lte_or_gte = lte_or_gte.to_s == "lte" ? "<=" : ">="
16
+ where("((dirty_history_records.revised_created_at is NULL OR dirty_history_records.revised_created_at = '') AND created_at #{lte_or_gte} ?) " +
17
+ " OR revised_created_at #{lte_or_gte} ?", date, date)
18
+ }
19
+
12
20
  [:new_value, :old_value].each do |attribute|
13
21
  define_method "#{attribute}" do
14
22
  val_to_col_type(attribute)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dirty_history
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-01 00:00:00.000000000 Z
12
+ date: 2012-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
@@ -2345,7 +2345,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
2345
2345
  version: '0'
2346
2346
  segments:
2347
2347
  - 0
2348
- hash: -2655685604412625334
2348
+ hash: 3508336063945515049
2349
2349
  required_rubygems_version: !ruby/object:Gem::Requirement
2350
2350
  none: false
2351
2351
  requirements:
@@ -2354,7 +2354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2354
2354
  version: '0'
2355
2355
  requirements: []
2356
2356
  rubyforge_project:
2357
- rubygems_version: 1.8.21
2357
+ rubygems_version: 1.8.24
2358
2358
  signing_key:
2359
2359
  specification_version: 3
2360
2360
  summary: Easily keep track of changes to specific model fields.