qui-automatic-form-required-fields 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/qui-automatic-form-required-fields.rb +7 -3
- metadata +4 -4
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
gemspec.email = "marcin@saepia.net"
|
10
10
|
gemspec.homepage = "http://q.saepia.net"
|
11
11
|
gemspec.authors = ["Marcin Lewandowski"]
|
12
|
-
gemspec.version = "0.0.
|
12
|
+
gemspec.version = "0.0.2"
|
13
13
|
gemspec.files = Rake::FileList.new [ "MIT-LICENSE", "Rakefile", "public/stylesheets/qui/*", "lib/*", "rails/*", "README.rdoc" ]
|
14
14
|
end
|
15
15
|
rescue LoadError
|
@@ -1,14 +1,18 @@
|
|
1
1
|
class ActiveRecord::Base
|
2
2
|
cattr_reader :required_fields
|
3
3
|
|
4
|
+
def self.required_fields
|
5
|
+
@required_fields
|
6
|
+
end
|
7
|
+
|
4
8
|
def self.validates_presence_of(*attr_names)
|
5
9
|
original_attr_names = attr_names
|
6
10
|
|
7
11
|
attr_names.extract_options!
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
13
|
+
@required_fields ||= []
|
14
|
+
@required_fields += attr_names.collect(&:to_sym)
|
15
|
+
@required_fields.uniq!
|
12
16
|
|
13
17
|
super original_attr_names
|
14
18
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qui-automatic-form-required-fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marcin Lewandowski
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-22 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|