rails_tools-unchanged_validator 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ Copyright 2013 Roberto Vasquez Angel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = UnchangedValidator for Rails
2
+
3
+ Docs coming soon...
@@ -0,0 +1,5 @@
1
+ de:
2
+ activerecord:
3
+ errors:
4
+ messages:
5
+ unchanged: "darf nicht geändert werden"
@@ -0,0 +1,5 @@
1
+ en:
2
+ activerecord:
3
+ errors:
4
+ messages:
5
+ unchanged: "can't be changed"
@@ -0,0 +1,10 @@
1
+ module ActiveModel
2
+ module Validations
3
+ class UnchangedValidator < ::ActiveModel::EachValidator
4
+ def validate_each(record, attribute, value)
5
+ record.errors.add(attribute, options[:message] || :unchanged) if record.send("#{attribute}_changed?")
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,3 @@
1
+ require 'rails_tools/unchanged_validator/engine'
2
+ require 'rails_tools/unchanged_validator/version'
3
+ require 'active_model/validations/unchanged_validator'
@@ -0,0 +1,8 @@
1
+ module Ecm
2
+ module RailsTools
3
+ module UnchangedValidator
4
+ class Engine < Rails::Engine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ module RailsTools
2
+ module UnchangedValidator
3
+ VERSION = "0.0.1.pre"
4
+ end
5
+ end
6
+
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_tools-unchanged_validator
3
+ version: !ruby/object:Gem::Version
4
+ hash: 961915968
5
+ prerelease: 6
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ - pre
11
+ version: 0.0.1.pre
12
+ platform: ruby
13
+ authors:
14
+ - Roberto Vasquez Angel
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2013-03-29 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 5
30
+ segments:
31
+ - 3
32
+ - 2
33
+ - 5
34
+ version: 3.2.5
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Provides an unchanged validator for active model.
38
+ email:
39
+ - roberto@vasquez-angel.de
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - config/locales/unchanged_validator.de.yml
48
+ - config/locales/unchanged_validator.en.yml
49
+ - lib/rails_tools-unchanged_validator.rb
50
+ - lib/rails_tools/unchanged_validator/engine.rb
51
+ - lib/rails_tools/unchanged_validator/version.rb
52
+ - lib/active_model/validations/unchanged_validator.rb
53
+ - MIT-LICENSE
54
+ - README.rdoc
55
+ homepage: https://github.com/robotex82/rails_tools-unchanged_validator
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">"
76
+ - !ruby/object:Gem::Version
77
+ hash: 25
78
+ segments:
79
+ - 1
80
+ - 3
81
+ - 1
82
+ version: 1.3.1
83
+ requirements: []
84
+
85
+ rubyforge_project:
86
+ rubygems_version: 1.8.24
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: Provides an unchanged validator for active model.
90
+ test_files: []
91
+
92
+ has_rdoc: