update_attribute_with_validations 0.1.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.
@@ -0,0 +1,12 @@
1
+ module ActiveRecord
2
+ module Persistence
3
+ def update_attribute_with_validations(name, value)
4
+ raise ActiveRecordError, "#{name} is marked as readonly" if self.class.readonly_attributes.include?(name.to_s)
5
+ with_transaction_returning_status do
6
+ send("#{name}=", value)
7
+ save
8
+ end
9
+ end
10
+ alias_method_chain :update_attribute, :validations
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: update_attribute_with_validations
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
10
+ platform: ruby
11
+ authors:
12
+ - Jonathan Garvin
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-21 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activerecord
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 3
30
+ - 0
31
+ - 1
32
+ version: 3.0.1
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: " Changes ActiveRecord's update_attribute (singular) method to behave more intuitively and consistently like\n update_attributes (plural). ActiveRecord's built-in update_attribute (singular) will not check validations\n on the object before saving, unlike update_attributes (plural), which will. \n \n"
36
+ email:
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - lib/update_attribute_with_validations.rb
45
+ has_rdoc: true
46
+ homepage: http://github.com/jsgarvin/update_attribute_with_validations
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options: []
51
+
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ requirements: []
71
+
72
+ rubyforge_project:
73
+ rubygems_version: 1.3.7
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Changes ActiveRecord's update_attribute (singular) method to behave like update_attributes (plural)
77
+ test_files: []
78
+