From e05e9979075b37342b7c88e557dbffd672b2086a Mon Sep 17 00:00:00 2001 From: Jeff Kreeftmeijer Date: Wed, 9 Mar 2011 10:58:18 +0100 Subject: Add a note to discourage users from using presence validators with allow_(nil|blank) --- railties/guides/source/active_record_validations_callbacks.textile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index 58a184a48e..2301d6715d 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -463,9 +463,11 @@ h3. Common Validation Options There are some common options that all the validation helpers can use. Here they are, except for the +:if+ and +:unless+ options, which are discussed later in "Conditional Validation":#conditional-validation. +TIP: Note that +allow_nil+ and +allow_blank+ will be ignored when using the presence validator. Please use the length validator if you want to validate if something is a specific length but allows for +nil+ values. + h4. +:allow_nil+ -The +:allow_nil+ option skips the validation when the value being validated is +nil+. Using +:allow_nil+ with +validates_presence_of+ allows for +nil+, but any other +blank?+ value will still be rejected. +The +:allow_nil+ option skips the validation when the value being validated is +nil+. class Coffee < ActiveRecord::Base -- cgit v1.2.3 From 6fba542f4487bd825203ea5b14bf038fe722709b Mon Sep 17 00:00:00 2001 From: David Aaron Fendley Date: Wed, 9 Mar 2011 18:06:50 -0600 Subject: Added note re: functional tests and HTTP methods. --- railties/guides/source/testing.textile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'railties/guides/source') diff --git a/railties/guides/source/testing.textile b/railties/guides/source/testing.textile index a75cedbdc1..f4111269ba 100644 --- a/railties/guides/source/testing.textile +++ b/railties/guides/source/testing.textile @@ -500,6 +500,8 @@ If you're familiar with the HTTP protocol, you'll know that +get+ is a type of r All of request types are methods that you can use, however, you'll probably end up using the first two more often than the others. +NOTE: Functional tests do not verify whether the specified request type should be be accepted by the action. Request types in this context exist to make your tests more descriptive. + h4. The Four Hashes of the Apocalypse After a request has been made by using one of the 5 methods (+get+, +post+, etc.) and processed, you will have 4 Hash objects ready for use: -- cgit v1.2.3 From 439ccdc3cf2aa46e22a8dfb7debcee073127df86 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 10 Mar 2011 19:58:55 +0530 Subject: update plugin urls to reflect official maintainers --- railties/guides/source/3_0_release_notes.textile | 4 ++-- railties/guides/source/active_record_validations_callbacks.textile | 2 +- railties/guides/source/debugging_rails_applications.textile | 2 +- railties/guides/source/form_helpers.textile | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/3_0_release_notes.textile b/railties/guides/source/3_0_release_notes.textile index 001f458fd9..f75b245ed8 100644 --- a/railties/guides/source/3_0_release_notes.textile +++ b/railties/guides/source/3_0_release_notes.textile @@ -59,12 +59,12 @@ The +config.gem+ method is gone and has been replaced by using +bundler+ and a + h4. Upgrade Process -To help with the upgrade process, a plugin named "Rails Upgrade":http://github.com/rails/rails_upgrade has been created to automate part of it. +To help with the upgrade process, a plugin named "Rails Upgrade":http://github.com/jm/rails_upgrade has been created to automate part of it. Simply install the plugin, then run +rake rails:upgrade:check+ to check your app for pieces that need to be updated (with links to information on how to update them). It also offers a task to generate a +Gemfile+ based on your current +config.gem+ calls and a task to generate a new routes file from your current one. To get the plugin, simply run the following: -$ ruby script/plugin install git://github.com/rails/rails_upgrade.git +$ ruby script/plugin install git://github.com/jm/rails_upgrade.git You can see an example of how that works at "Rails Upgrade is now an Official Plugin":http://omgbloglol.com/post/364624593/rails-upgrade-is-now-an-official-plugin diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index 2301d6715d..bfb06a9cd5 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -744,7 +744,7 @@ Rails maintains an official plugin that provides helpers to display the error me h4. Installing as a plugin -$ rails plugin install git://github.com/rails/dynamic_form.git +$ rails plugin install git://github.com/joelmoss/dynamic_form.git h4 Installing as a Gem diff --git a/railties/guides/source/debugging_rails_applications.textile b/railties/guides/source/debugging_rails_applications.textile index 67e17056e5..045b8823ca 100644 --- a/railties/guides/source/debugging_rails_applications.textile +++ b/railties/guides/source/debugging_rails_applications.textile @@ -686,7 +686,7 @@ There are some Rails plugins to help you to find errors and debug your applicati * "Query Trace":https://github.com/ntalbott/query_trace/tree/master: Adds query origin tracing to your logs. * "Query Stats":https://github.com/dan-manges/query_stats/tree/master: A Rails plugin to track database queries. * "Query Reviewer":http://code.google.com/p/query-reviewer/: This rails plugin not only runs "EXPLAIN" before each of your select queries in development, but provides a small DIV in the rendered output of each page with the summary of warnings for each query that it analyzed. -* "Exception Notifier":https://github.com/rails/exception_notification/tree/master: Provides a mailer object and a default set of templates for sending email notifications when errors occur in a Rails application. +* "Exception Notifier":https://github.com/smartinez87/exception_notification/tree/master: Provides a mailer object and a default set of templates for sending email notifications when errors occur in a Rails application. * "Exception Logger":https://github.com/defunkt/exception_logger/tree/master: Logs your Rails exceptions in the database and provides a funky web interface to manage them. h3. References diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile index 0cfc005f80..1f21c27ae6 100644 --- a/railties/guides/source/form_helpers.textile +++ b/railties/guides/source/form_helpers.textile @@ -475,7 +475,7 @@ To leverage time zone support in Rails, you have to ask your users what time zon There is also +time_zone_options_for_select+ helper for a more manual (therefore more customizable) way of doing this. Read the API documentation to learn about the possible arguments for these two methods. -Rails _used_ to have a +country_select+ helper for choosing countries, but this has been extracted to the "country_select plugin":https://github.com/rails/country_select/tree/master. When using this, be aware that the exclusion or inclusion of certain names from the list can be somewhat controversial (and was the reason this functionality was extracted from Rails). +Rails _used_ to have a +country_select+ helper for choosing countries, but this has been extracted to the "country_select plugin":https://github.com/chrislerum/country_select. When using this, be aware that the exclusion or inclusion of certain names from the list can be somewhat controversial (and was the reason this functionality was extracted from Rails). h3. Using Date and Time Form Helpers -- cgit v1.2.3 From ee7c48678f443ed7fb77fe97042f7a698e359df9 Mon Sep 17 00:00:00 2001 From: Mike Gehard Date: Thu, 10 Mar 2011 10:08:30 -0500 Subject: Minor formatting changes and remove a comment --- railties/guides/source/plugins.textile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index daca50ee9e..2d9821e627 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -45,9 +45,9 @@ as a gem. This tutorial will begin to bridge that gap by demonstrating how to c "Enginex gem":http://www.github.com/josevalim/enginex. - gem install enginex - enginex --help - enginex yaffle +$ gem install enginex +$ enginex --help +$ enginex yaffle This command will create a new directory named "yaffle" within the current directory. @@ -401,7 +401,9 @@ h3. Publishing your Gem Gem plugins in progress can be easily be shared from any Git repository. To share the Yaffle gem with others, simply commit the code to a Git repository (like Github) and add a line to the Gemfile of the any application: -gem 'yaffle', :git => 'git://github.com/yaffle_watcher/yaffle.git' + +gem 'yaffle', :git => 'git://github.com/yaffle_watcher/yaffle.git' + After running +bundle install+, your gem functionality will be available to the application. @@ -450,8 +452,6 @@ Once your comments are good to go, navigate to your plugin directory and run: $ rake rdoc -!!!!!!!!!!!!!! Make sure these still make sense. Add any references that you see fit. !!!!!!!!!!!!! - h4. References * "Developing a RubyGem using Bundler":https://github.com/radar/guides/blob/master/gem-development.md @@ -462,6 +462,7 @@ h4. References h3. Changelog +* March 10, 2011: Minor formatting tweaks. * February 13, 2011: Get guide in synch with Rails 3.0.3. Remove information not compatible with Rails 3. Send reader elsewhere for information that is covered elsewhere. * April 4, 2010: Fixed document to validate XHTML 1.0 Strict. "Jaime Iniesta":http://jaimeiniesta.com -- cgit v1.2.3 From c540b3544100a29d3d34ada220c175dbd70bab2f Mon Sep 17 00:00:00 2001 From: Lars Smit Date: Sun, 13 Mar 2011 09:07:23 +0100 Subject: Removed double texts --- .../guides/source/contributing_to_ruby_on_rails.textile | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/contributing_to_ruby_on_rails.textile b/railties/guides/source/contributing_to_ruby_on_rails.textile index 4ba01a2a8f..846a25d6d2 100644 --- a/railties/guides/source/contributing_to_ruby_on_rails.textile +++ b/railties/guides/source/contributing_to_ruby_on_rails.textile @@ -364,19 +364,6 @@ Please make sure the patch does not introduce whitespace errors: $ git apply --whitespace=error-all mynew_patch.diff -You can check your patches by applying your patch to an different dedicated branch: - - -$ git checkout -b testing_branch -$ git apply --check my_new_patch.diff - - -You can make sure your patches don't add any whitespace by applying it yourself using the --whitespace=error-all option. Make sure you are on your dedicated test branche and: - - -$ git apply --whitespace=error-all mynew_patch.diff - - h4. Create a Lighthouse Ticket -- cgit v1.2.3 From de5e41f855a8d715d99eec6195f9b31cc4048b99 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 14 Mar 2011 21:59:58 +0100 Subject: move the tips about :allow_(nil|blank) near their explanations, also no need to say these are options for all validators if they are not --- .../guides/source/active_record_validations_callbacks.textile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index bfb06a9cd5..e5349d546c 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -461,9 +461,7 @@ The block receives the model, the attribute's name and the attribute's value. Yo h3. Common Validation Options -There are some common options that all the validation helpers can use. Here they are, except for the +:if+ and +:unless+ options, which are discussed later in "Conditional Validation":#conditional-validation. - -TIP: Note that +allow_nil+ and +allow_blank+ will be ignored when using the presence validator. Please use the length validator if you want to validate if something is a specific length but allows for +nil+ values. +These are common validation options: h4. +:allow_nil+ @@ -476,6 +474,8 @@ class Coffee < ActiveRecord::Base end +TIP: +:allow_nil+ is ignored by the presence validator. + h4. +:allow_blank+ The +:allow_blank+ option is similar to the +:allow_nil+ option. This option will let validation pass if the attribute's value is +blank?+, like +nil+ or an empty string for example. @@ -489,6 +489,8 @@ Topic.create("title" => "").valid? # => true Topic.create("title" => nil).valid? # => true +TIP: +:allow_blank+ is ignored by the presence validator. + h4. +:message+ As you've already seen, the +:message+ option lets you specify the message that will be added to the +errors+ collection when validation fails. When this option is not used, Active Record will use the respective default error message for each validation helper. -- cgit v1.2.3 From a0826cceea8d181cc28046929c9025147f9325af Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 14 Mar 2011 22:06:27 +0100 Subject: be be -> be --- railties/guides/source/testing.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/testing.textile b/railties/guides/source/testing.textile index f4111269ba..4ebdb3edf6 100644 --- a/railties/guides/source/testing.textile +++ b/railties/guides/source/testing.textile @@ -500,7 +500,7 @@ If you're familiar with the HTTP protocol, you'll know that +get+ is a type of r All of request types are methods that you can use, however, you'll probably end up using the first two more often than the others. -NOTE: Functional tests do not verify whether the specified request type should be be accepted by the action. Request types in this context exist to make your tests more descriptive. +NOTE: Functional tests do not verify whether the specified request type should be accepted by the action. Request types in this context exist to make your tests more descriptive. h4. The Four Hashes of the Apocalypse -- cgit v1.2.3