untraceable-save 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +15 -0
- data/lib/untraceable-save/version.rb +3 -0
- data/lib/untraceable-save.rb +62 -0
- metadata +74 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZWMxZjA2MWM0YWZkMTlmYjZiNjNjN2E4NTU4MGZjZGYzZjE1YTU4ZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MWNiNTk0NTExOTAwNjM2NTRjNTNhZGJjNmNmZmMwNjcyZDJlZjg0Nw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ODQwMjNiNDM4MjEwZGQwMzRkMGZjZjM0ODY0MDllZjIwMmVkZGNkY2ZjMjg0
|
10
|
+
YWZjNTJiYjliYTFjYzVjNTAzYzk0YzlkNTBlYjMzNzY3Nzk0YWI2ZDUxMmZi
|
11
|
+
MmUyZjg2YjA0YjhlMGVlYWViYzQ2OWEyMjQ5ZDU5ZWE4NDk5NTU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZGQ2MzI2NjBlMTFjOWVmOTNmODc0ZjNjNWViZTJlNDYwMThiMTc3YmY5ZmEy
|
14
|
+
NDZlNmQ2NTAyZmI3MWU0ZGRjODNjOTE0MmVkZTY4ZjVkYzc3NjM4NzhmZGU1
|
15
|
+
Y2I3YWE2ZmRmNjc0ODk1NjFmMDEzYmE2MGMxOWU0YzQ4ZDQzZjE=
|
data/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
## untraceable-save
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/untraceable-save.png)](http://badge.fury.io/rb/untraceable-save)
|
3
|
+
[![Build Status](https://travis-ci.org/vforge/untraceable-save.png)](https://travis-ci.org/vforge/untraceable-save)
|
4
|
+
[![Dependency Status](https://gemnasium.com/vforge/untraceable-save.png)](https://gemnasium.com/vforge/untraceable-save)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/vforge/untraceable-save.png)](https://codeclimate.com/github/vforge/untraceable-save)
|
6
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/vforge/untraceable-save/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
7
|
+
|
8
|
+
ActiveRecord untraceable save.
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
* `untraceable_save` - saves record without timestamps.
|
13
|
+
* `quiet_save` - saves record without timestamps and without validating data.
|
14
|
+
|
15
|
+
**Also**: There are bang (`!`) versions too.
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require "untraceable-save/version"
|
2
|
+
|
3
|
+
require "active_record" unless defined?(ActiveRecord)
|
4
|
+
require "active_support" unless defined?(ActiveSupport)
|
5
|
+
|
6
|
+
module UntraceableSave
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
# update that record without timestamping
|
11
|
+
def untraceable_save(options = {})
|
12
|
+
class << self
|
13
|
+
def record_timestamps; false; end
|
14
|
+
end
|
15
|
+
|
16
|
+
ret = save options
|
17
|
+
|
18
|
+
class << self
|
19
|
+
remove_method :record_timestamps
|
20
|
+
end
|
21
|
+
|
22
|
+
ret
|
23
|
+
end
|
24
|
+
|
25
|
+
# update record without validation and timestamping
|
26
|
+
def quiet_save(options = {})
|
27
|
+
options[:validate] = false
|
28
|
+
|
29
|
+
self.untraceable_save(options)
|
30
|
+
end
|
31
|
+
|
32
|
+
# update that record without timestamping
|
33
|
+
def untraceable_save!(options = {})
|
34
|
+
class << self
|
35
|
+
def record_timestamps; false; end
|
36
|
+
end
|
37
|
+
|
38
|
+
ret = save! options
|
39
|
+
|
40
|
+
class << self
|
41
|
+
remove_method :record_timestamps
|
42
|
+
end
|
43
|
+
|
44
|
+
ret
|
45
|
+
end
|
46
|
+
|
47
|
+
# update record without validation and timestamping
|
48
|
+
def quiet_save!(options = {})
|
49
|
+
options[:validate] = false
|
50
|
+
|
51
|
+
self.untraceable_save!(options)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
module ClassMethods
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# include the extension
|
60
|
+
ActiveRecord::Base.send :include, UntraceableSave
|
61
|
+
|
62
|
+
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: untraceable-save
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bartosz "V." Bentkowski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
41
|
+
description: ActiveRecord untraceable save.
|
42
|
+
email: bartosz.bentkowski@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- README.md
|
48
|
+
- lib/untraceable-save.rb
|
49
|
+
- lib/untraceable-save/version.rb
|
50
|
+
homepage: https://github.com/vforge/untraceable-save
|
51
|
+
licenses:
|
52
|
+
- MIT
|
53
|
+
metadata: {}
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
requirements: []
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 2.2.2
|
71
|
+
signing_key:
|
72
|
+
specification_version: 4
|
73
|
+
summary: ActiveRecord untraceable save.
|
74
|
+
test_files: []
|