veracious 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/README.rdoc +40 -1
  2. metadata +3 -3
@@ -1,4 +1,43 @@
1
1
  =Introduction
2
2
 
3
3
  Gee... it sure would be awesome if ActiveResource _actually_ allowed us to do client-side validation of our ActiveResource objects
4
- like their documentation promises:http://apidock.com/rails/ActiveResource/Base
4
+ like the ActiveResource::Base documentation promises[http://apidock.com/rails/ActiveResource/Base]
5
+
6
+
7
+ =Installation
8
+
9
+ To install, add this to your environment.rb:
10
+
11
+ config.gem 'wallet', :version => '0.0.2', :lib => 'wallet', :source => 'http://gemcutter.org'
12
+
13
+ Next, go to the root of your project in a shell and run this command (you may need to use "sudo" depending on your environment):
14
+
15
+ sh# rake gems:install
16
+
17
+ =Usage
18
+
19
+ You can now create a protected "validate" method in your ActiveResource::Base-derived class:
20
+
21
+ class Book < ActiveResource::Base
22
+ self.site = 'http://myservice.domain'
23
+
24
+ protected
25
+ def validate
26
+ errors.add(:author, 'is required') if (author.blank? rescue true)
27
+ end
28
+ end
29
+
30
+ Now, in your code, you can do the following:
31
+
32
+ irb> b = Book.new
33
+ irb> b.valid?
34
+ ==> false
35
+ irb> b.author = ''
36
+ irb> b.valid?
37
+ ==> false
38
+ irb> b.author = 'Iain M. Banks'
39
+ irb> b.valid?
40
+ ==> true
41
+
42
+ When you call the _valid?_ method on your active resource object, it will do client side validation. It will *not* send a request to the service provider for validation.
43
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veracious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Parker
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-09 00:00:00 -05:00
12
+ date: 2009-11-10 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.3.3
24
24
  version:
25
- description: "Gee\xE2\x80\xA6 it sure would be awesome if ActiveResource actually allowed usto do client-side validation of our ActiveResource objects like theirdocumentation promises: http://apidock.com/rails/ActiveResource/Base"
25
+ description: "It sure would be awesome if ActiveResource actually allowed us to do client-side validation of our ActiveResource objects like their documentation promises: http://apidock.com/rails/ActiveResource/Base"
26
26
  email: moonmaster9000@gmail.com
27
27
  executables: []
28
28