update-fields 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +15 -0
- data/Rakefile +15 -0
- data/VERSION +1 -0
- data/lib/update-fields.rb +11 -0
- data/lib/update_fields/update_fields.rb +11 -0
- data/rails/init.rb +1 -0
- metadata +72 -0
data/README.rdoc
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
= UpdateFields
|
2
|
+
|
3
|
+
== Installation
|
4
|
+
|
5
|
+
=== Rails 3.0
|
6
|
+
|
7
|
+
Add the following to your Gemfile:
|
8
|
+
|
9
|
+
gem 'update-fields'
|
10
|
+
|
11
|
+
== Usage
|
12
|
+
|
13
|
+
Copyright (c) 2011 Andrew Hunter (http://github.com/hunterae) and Captico LLC. (http://captico.com/), released under the MIT license
|
14
|
+
|
15
|
+
== Special Thanks
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |gemspec|
|
4
|
+
gemspec.name = "update-fields"
|
5
|
+
gemspec.summary = "update-fields provides convience methods for running an atomic update on a single field or multiple fields in a database row."
|
6
|
+
gemspec.description = "update-fields provides convience methods for running an atomic update on a single field or multiple fields in a database row."
|
7
|
+
gemspec.email = "hunterae@gmail.com"
|
8
|
+
gemspec.homepage = "http://github.com/hunterae/update_fields"
|
9
|
+
gemspec.authors = ["Andrew Hunter"]
|
10
|
+
gemspec.files = FileList["[A-Z]*", "{lib,spec,rails}/**/*"] - FileList["**/*.log"]
|
11
|
+
end
|
12
|
+
Jeweler::GemcutterTasks.new
|
13
|
+
rescue LoadError
|
14
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
15
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module UpdateFields
|
2
|
+
module InstanceMethods
|
3
|
+
def update_field(field, value)
|
4
|
+
self.class.where(:id => self.id).update_all("#{field} = #{value}")
|
5
|
+
end
|
6
|
+
|
7
|
+
def update_fields(options={})
|
8
|
+
self.class.where(:id => self.id).update_all(options)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'update-fields'
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: update-fields
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Andrew Hunter
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-29 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: update-fields provides convience methods for running an atomic update on a single field or multiple fields in a database row.
|
23
|
+
email: hunterae@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README.rdoc
|
30
|
+
files:
|
31
|
+
- README.rdoc
|
32
|
+
- Rakefile
|
33
|
+
- VERSION
|
34
|
+
- lib/update-fields.rb
|
35
|
+
- lib/update_fields/update_fields.rb
|
36
|
+
- rails/init.rb
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://github.com/hunterae/update_fields
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
version: "0"
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 1.3.7
|
68
|
+
signing_key:
|
69
|
+
specification_version: 3
|
70
|
+
summary: update-fields provides convience methods for running an atomic update on a single field or multiple fields in a database row.
|
71
|
+
test_files: []
|
72
|
+
|