realtime-validations 0.0.11 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,63 +1,75 @@
1
- = Realtime Validations for Rails
1
+ == Introduction
2
2
 
3
- Gem that is able to run validations on models while the form is being filled by the user.
3
+ RealtimeValidations is a Rails 3.1 gem that allows you to easily validate your forms. It is very
4
+ easy to use, clean and yet powerful.
4
5
 
5
6
  == Why
6
7
 
7
- It is smart in the sense that is able to fulfill any kind of validation. For instance, if
8
- configured properly, it can run even validations that are :scoped by some other model.
8
+ It is smart in the sense that is able to fulfill any kind of validation.
9
9
 
10
10
  Also, it allows to add some information based on the current session, user, client... so the model
11
- to be created or edited can be linked to that session, user or client.
11
+ has all the required information to perform a complete validation test.
12
12
 
13
13
  It is very generic and is not tied to any specific case of use.
14
14
 
15
- == Setup
15
+ == Remember
16
16
 
17
- === Gemfile
18
-
19
- gem 'realtime-validations'
17
+ This gem is simple. Very simple. It is developed with some things in mind:
20
18
 
21
- === Running generators
19
+ * Forget about validations at client side.
20
+ * All this logic is placed at the model, and is how it should be.
21
+ * Do not replicate logic in javascript.
22
+ * Never, ever replicate logic.
23
+ * Someone updates some validation on some model, and javascript is forgotten to be updated.
24
+ * You need to replicate the same logic in two different languages with their implementation
25
+ differences.
26
+ * Highly configurable.
27
+ * There are three hooks to configure the behaviour as you want.
28
+ 1. Server: when the Controller module is included into the ValidationsController class.
29
+ * Here you can remove or add filters.
30
+ 2. Server: before asking for the model validity.
31
+ * You can add extra information to the model here based on the knowledge of the current
32
+ situation of the ApplicationController, such as the current client id or user id.
33
+ 3. Client: before sending the request to the ValidationsController.
34
+ * Here you are able to add more information to the request, for instance retrieving it
35
+ from a meta tag on the page or wherever you want, is up to you.
22
36
 
23
- rails g realtime_validations:install
37
+ == Dependencies
24
38
 
25
- Read more about what the generators do on the Wiki pages.
39
+ RealtimeValidations gem does not have too many dependencies:
26
40
 
27
- === Putting everything together
28
-
29
- === Assets pipeline
41
+ * Rails 3.1.
42
+ * jquery-rails.
30
43
 
31
- Include javascript file and stylesheet file in your assets pipeline:
44
+ == Installation
32
45
 
33
- # app/assets/javascripts/application.js
34
- //= require realtime_validations
46
+ Installation is very easy on your own project:
35
47
 
36
- # app/assets/stylesheets/application.css
37
- *= require realtime_validations
38
-
39
- ==== Views
48
+ === Gemfile
40
49
 
41
- You should use:
50
+ gem 'realtime-validations'
42
51
 
43
- form_validated_for
52
+ === Running generators
44
53
 
45
- instead of:
54
+ rails g realtime_validations:install
46
55
 
47
- form_for
56
+ === Assets pipeline
48
57
 
49
- where you want the engine to validate your fields automatically.
58
+ Include the core javascript of the application:
50
59
 
51
- === Check if the engine is correctly imported
60
+ # app/assets/javascripts/application.js
61
+ //= require realtime_validations
52
62
 
53
- Run:
63
+ For now it is necessary to include the stylesheet too, but it will be optional in next versions:
54
64
 
55
- rake routes
65
+ # app/assets/stylesheets/application.css
66
+ *= require realtime_validations
56
67
 
57
- and check if it contains a route for:
68
+ == Usage
58
69
 
59
- POST /validations/*args(.:format) realtime_validations/validations#validate
70
+ Usage is very transparent from your project:
60
71
 
61
- === Examples
72
+ === Views
62
73
 
63
- realtime-validations-examples[https://github.com/ereslibre/realtime-validations-examples] contains some examples that can be of use if you are starting to use this gem.
74
+ You should use +form_validated_for+ instead of +form_for+ on your forms in order for them to
75
+ automatically validate.
@@ -1,6 +1,6 @@
1
1
  module RealtimeValidations
2
2
 
3
- class ValidationsController < ApplicationController
3
+ class ValidationsController < ApplicationController #:nodoc:
4
4
 
5
5
  include Controller
6
6
 
@@ -2,9 +2,9 @@ require 'rails/generators'
2
2
 
3
3
  module RealtimeValidations
4
4
 
5
- module Generators
5
+ module Generators #:nodoc:
6
6
 
7
- class InstallGenerator < Rails::Generators::Base
7
+ class InstallGenerator < Rails::Generators::Base #:nodoc:
8
8
 
9
9
  source_root File.join(File.dirname(__FILE__), 'templates')
10
10
 
@@ -1,3 +1,3 @@
1
1
  module RealtimeValidations
2
- VERSION = '0.0.11'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -1,6 +1,81 @@
1
+ # == Introduction
2
+ #
3
+ # RealtimeValidations is a Rails 3.1 gem that allows you to easily validate your forms. It is very
4
+ # easy to use, clean and yet powerful.
5
+ #
6
+ # == Why
7
+ #
8
+ # It is smart in the sense that is able to fulfill any kind of validation.
9
+ #
10
+ # Also, it allows to add some information based on the current session, user, client... so the model
11
+ # has all the required information to perform a complete validation test.
12
+ #
13
+ # It is very generic and is not tied to any specific case of use.
14
+ #
15
+ # == Remember
16
+ #
17
+ # This gem is simple. Very simple. It is developed with some things in mind:
18
+ #
19
+ # * Forget about validations at client side.
20
+ # * All this logic is placed at the model, and is how it should be.
21
+ # * Do not replicate logic in javascript.
22
+ # * Never, ever replicate logic.
23
+ # * Someone updates some validation on some model, and javascript is forgotten to be updated.
24
+ # * You need to replicate the same logic in two different languages with their implementation
25
+ # differences.
26
+ # * Highly configurable.
27
+ # * There are three hooks to configure the behaviour as you want.
28
+ # 1. Server: when the Controller module is included into the ValidationsController class.
29
+ # * Here you can remove or add filters.
30
+ # 2. Server: before asking for the model validity.
31
+ # * You can add extra information to the model here based on the knowledge of the current
32
+ # situation of the ApplicationController, such as the current client id or user id.
33
+ # 3. Client: before sending the request to the ValidationsController.
34
+ # * Here you are able to add more information to the request, for instance retrieving it
35
+ # from a meta tag on the page or wherever you want, is up to you.
36
+ #
37
+ # == Dependencies
38
+ #
39
+ # RealtimeValidations gem does not have too many dependencies:
40
+ #
41
+ # * Rails 3.1.
42
+ # * jquery-rails.
43
+ #
44
+ # == Installation
45
+ #
46
+ # Installation is very easy on your own project:
47
+ #
48
+ # === Gemfile
49
+ #
50
+ # gem 'realtime-validations'
51
+ #
52
+ # === Running generators
53
+ #
54
+ # rails g realtime_validations:install
55
+ #
56
+ # === Assets pipeline
57
+ #
58
+ # Include the core javascript of the application:
59
+ #
60
+ # # app/assets/javascripts/application.js
61
+ # //= require realtime_validations
62
+ #
63
+ # For now it is necessary to include the stylesheet too, but it will be optional in next versions:
64
+ #
65
+ # # app/assets/stylesheets/application.css
66
+ # *= require realtime_validations
67
+ #
68
+ # == Usage
69
+ #
70
+ # Usage is very transparent from your project:
71
+ #
72
+ # === Views
73
+ #
74
+ # You should use +form_validated_for+ instead of +form_for+ on your forms in order for them to
75
+ # automatically validate.
1
76
  module RealtimeValidations
2
77
 
3
- class RealtimeValidations < Rails::Engine
78
+ class RealtimeValidations < Rails::Engine #:nodoc:
4
79
  end
5
80
 
6
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: realtime-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-01 00:00:00.000000000 Z
12
+ date: 2012-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &8991040 !ruby/object:Gem::Requirement
16
+ requirement: &19370620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8991040
24
+ version_requirements: *19370620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &8990220 !ruby/object:Gem::Requirement
27
+ requirement: &19370200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *8990220
35
+ version_requirements: *19370200
36
36
  description: Form real time validations for free on Rails applications
37
37
  email:
38
38
  - ereslibre@gmail.com
@@ -41,49 +41,49 @@ extensions: []
41
41
  extra_rdoc_files: []
42
42
  files:
43
43
  - app/controllers/realtime_validations/validations_controller.rb
44
- - config/initializers/form_validated_for.rb
45
44
  - config/routes.rb
45
+ - config/initializers/form_validated_for.rb
46
+ - lib/realtime-validations.rb
47
+ - lib/realtime-validations/version.rb
48
+ - lib/generators/realtime_validations/install_generator.rb
46
49
  - lib/generators/realtime_validations/templates/initializer.rb
47
50
  - lib/generators/realtime_validations/templates/realtime_validations.custom.js
48
- - lib/generators/realtime_validations/install_generator.rb
49
- - lib/realtime-validations/version.rb
50
51
  - lib/tasks/realtime-validations_tasks.rake
51
- - lib/realtime-validations.rb
52
- - vendor/assets/javascripts/realtime_validations.js
53
52
  - vendor/assets/stylesheets/realtime_validations.css
53
+ - vendor/assets/javascripts/realtime_validations.js
54
54
  - MIT-LICENSE
55
55
  - Rakefile
56
56
  - README.rdoc
57
- - test/dummy/public/422.html
57
+ - test/test_helper.rb
58
58
  - test/dummy/public/404.html
59
- - test/dummy/public/500.html
60
59
  - test/dummy/public/favicon.ico
61
- - test/dummy/config.ru
62
- - test/dummy/script/rails
63
- - test/dummy/config/environments/test.rb
64
- - test/dummy/config/environments/development.rb
60
+ - test/dummy/public/422.html
61
+ - test/dummy/public/500.html
62
+ - test/dummy/config/application.rb
63
+ - test/dummy/config/database.yml
64
+ - test/dummy/config/environment.rb
65
+ - test/dummy/config/routes.rb
65
66
  - test/dummy/config/environments/production.rb
67
+ - test/dummy/config/environments/development.rb
68
+ - test/dummy/config/environments/test.rb
66
69
  - test/dummy/config/locales/en.yml
67
- - test/dummy/config/environment.rb
68
- - test/dummy/config/initializers/session_store.rb
69
- - test/dummy/config/initializers/inflections.rb
70
+ - test/dummy/config/boot.rb
70
71
  - test/dummy/config/initializers/mime_types.rb
71
- - test/dummy/config/initializers/backtrace_silencers.rb
72
72
  - test/dummy/config/initializers/wrap_parameters.rb
73
+ - test/dummy/config/initializers/session_store.rb
74
+ - test/dummy/config/initializers/inflections.rb
73
75
  - test/dummy/config/initializers/secret_token.rb
74
- - test/dummy/config/database.yml
75
- - test/dummy/config/routes.rb
76
- - test/dummy/config/boot.rb
77
- - test/dummy/config/application.rb
78
- - test/dummy/Rakefile
76
+ - test/dummy/config/initializers/backtrace_silencers.rb
77
+ - test/dummy/script/rails
78
+ - test/dummy/config.ru
79
+ - test/dummy/README.rdoc
80
+ - test/dummy/app/assets/stylesheets/application.css
81
+ - test/dummy/app/assets/javascripts/application.js
79
82
  - test/dummy/app/controllers/application_controller.rb
80
83
  - test/dummy/app/views/layouts/application.html.erb
81
84
  - test/dummy/app/helpers/application_helper.rb
82
- - test/dummy/app/assets/javascripts/application.js
83
- - test/dummy/app/assets/stylesheets/application.css
84
- - test/dummy/README.rdoc
85
+ - test/dummy/Rakefile
85
86
  - test/realtime-validations_test.rb
86
- - test/test_helper.rb
87
87
  homepage: http://www.ereslibre.es/
88
88
  licenses: []
89
89
  post_install_message:
@@ -104,38 +104,38 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 1.8.12
107
+ rubygems_version: 1.8.11
108
108
  signing_key:
109
109
  specification_version: 3
110
110
  summary: Provides real time validations for free
111
111
  test_files:
112
- - test/dummy/public/422.html
112
+ - test/test_helper.rb
113
113
  - test/dummy/public/404.html
114
- - test/dummy/public/500.html
115
114
  - test/dummy/public/favicon.ico
116
- - test/dummy/config.ru
117
- - test/dummy/script/rails
118
- - test/dummy/config/environments/test.rb
119
- - test/dummy/config/environments/development.rb
115
+ - test/dummy/public/422.html
116
+ - test/dummy/public/500.html
117
+ - test/dummy/config/application.rb
118
+ - test/dummy/config/database.yml
119
+ - test/dummy/config/environment.rb
120
+ - test/dummy/config/routes.rb
120
121
  - test/dummy/config/environments/production.rb
122
+ - test/dummy/config/environments/development.rb
123
+ - test/dummy/config/environments/test.rb
121
124
  - test/dummy/config/locales/en.yml
122
- - test/dummy/config/environment.rb
123
- - test/dummy/config/initializers/session_store.rb
124
- - test/dummy/config/initializers/inflections.rb
125
+ - test/dummy/config/boot.rb
125
126
  - test/dummy/config/initializers/mime_types.rb
126
- - test/dummy/config/initializers/backtrace_silencers.rb
127
127
  - test/dummy/config/initializers/wrap_parameters.rb
128
+ - test/dummy/config/initializers/session_store.rb
129
+ - test/dummy/config/initializers/inflections.rb
128
130
  - test/dummy/config/initializers/secret_token.rb
129
- - test/dummy/config/database.yml
130
- - test/dummy/config/routes.rb
131
- - test/dummy/config/boot.rb
132
- - test/dummy/config/application.rb
133
- - test/dummy/Rakefile
131
+ - test/dummy/config/initializers/backtrace_silencers.rb
132
+ - test/dummy/script/rails
133
+ - test/dummy/config.ru
134
+ - test/dummy/README.rdoc
135
+ - test/dummy/app/assets/stylesheets/application.css
136
+ - test/dummy/app/assets/javascripts/application.js
134
137
  - test/dummy/app/controllers/application_controller.rb
135
138
  - test/dummy/app/views/layouts/application.html.erb
136
139
  - test/dummy/app/helpers/application_helper.rb
137
- - test/dummy/app/assets/javascripts/application.js
138
- - test/dummy/app/assets/stylesheets/application.css
139
- - test/dummy/README.rdoc
140
+ - test/dummy/Rakefile
140
141
  - test/realtime-validations_test.rb
141
- - test/test_helper.rb