aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_record_validations.md
Commit message (Collapse)AuthorAgeFilesLines
* Raise deprecation for calling `[:f] = 'b'` or `[:f] << 'b'`lulalala2019-03-311-6/+6
| | | | Revert some tests to ensure back compatibility
* Update links and code examples in the guides to use HTTPS where the host ↵Nathaniel Suchy2019-03-061-2/+2
| | | | supports it.
* Delete documentation inconsistency 'finally' for AR callbacks [ci skip] ↵Shodai Suzuki2019-02-191-1/+1
| | | | (#35303)
* Merge pull request #34415 from Ana06/present_associationsGannon McGibbon2018-11-091-1/+2
|\ | | | | Clarify the validation of present associations
| * Clarify the validation of present associationsAna María Martínez Gómez2018-11-091-1/+2
| | | | | | | | | | | | I think that it is not clear what means that _an association is present_. Add that it is checking that the foreign key is not empty and that the referenced object exists to clarify it.
* | Merge pull request #33348 from ruralocity/update-validation-contexts-guideRyuta Kamizono2018-09-281-9/+27
|\ \ | | | | | | Update guide for validation custom contexts [ci skip]
| * | Update guide for validation custom contexts [ci skip]Aaron Sumner2018-07-111-9/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Active Record validations guide's section on custom contexts appears to be incomplete. the code sample shows a context being added to validations, but not being used. Add to the sample code for this section by showing validations being run with and without the custom context. Add a second sample code block showing that validations with no context are also run, when a context is used.
* | | Add lambdas in conditional validationsAna María Martínez Gómez2018-08-071-0/+7
| |/ |/| | | | | | | | | | | | | As `Lambdas` are a type of `Proc`, they can also be used in the `if`/`unless` option of a validation to decide when the validation is executed. Add this case to the guide for clarification. Closes https://github.com/rails/rails/issues/33212
* | Merge pull request #33229 from ↵Matthew Draper2018-07-251-1/+1
|\ \ | | | | | | | | | | | | albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails Prefer rails command over bin/rails
| * | Recommend use of rails over bin/railsAlberto Almagro2018-07-061-1/+1
| |/ | | | | | | | | | | | | | | | | As discussed in #33203 rails command already looks for, and runs, bin/rails if it is present. We were mixing recommendations within guides and USAGE guidelines, in some files we recommended using rails, in others bin/rails and in some cases we even had both options mixed together.
* | Rails guides are now served over httpsPaul McMahon2018-07-241-1/+1
| | | | | | | | | | http links will be redirected to the https version, but still better to just directly link to the https version.
* | Remove the invalid usage document about `errors`. [ci skip]lanzhiheng2018-07-161-18/+0
|/
* Added a lot of Oxford commasAnthony Crumley2018-05-101-1/+1
| | | | | | | [ci skip] A regular expression was used to find a lot of missing Oxford commas and add them. The regular expression was as follows. ", ([a-zA-Z0-9.\`:'\"]+ ){1,6}(or|and) "
* Fix typos [ci skip]Yauheni Dakuka2018-01-111-1/+1
|
* Remove obsolete explanationohbarye2017-08-171-1/+1
| | | | | | about passing string to `:if` and `:unless`. This is a follow up to https://github.com/rails/rails/pull/28058 [ci skip]
* Change http postgresql.org links to https [ci skip]yuuji.yaginuma2017-07-301-1/+1
| | | | | It seems that it accepts only HTTPS connections. Ref: https://github.com/postgres/postgres/commit/7f77cbd996855a06fb742ea11adbe55c42b48fe2
* Remove deprecated passing of string to :if/:unless (#29357)Joe Francis2017-06-061-1/+1
| | | | | Other examples were removed in 53ff5fc62f9d11b6f60d371df959137f4bf40728 [ci skip]
* Remove obsolete warning about regular expressionPhilipe Fatio2017-03-141-3/+0
| | | | | | | | | | This warning became obsolete when the regular expression was changed to use `\z` instead of `\Z` in fce9c4e5e1ecb31cff2ca43a04fbe332816c3c45. "-1234\n" =~ /\A[+-]?\d+\Z/ => 0 "-1234\n" =~ /\A[+-]?\d+\z/ => nil [ci skip]
* Remove deprecate passing string to `:if` and `:unless` conditional options ↵yuuji.yaginuma2017-02-181-12/+0
| | | | | | [ci skip] Follow up to #27608
* Correct usage for acceptance validator in guideTekin Suleyman2016-08-021-1/+1
|
* [ci skip] Expand information on message optionsschneems2016-06-081-3/+9
| | | | Link to the more detailed message documentation when using a message option in validations.
* Active Model: Improve CHANGELOG and documentation for ↵Prathamesh Sonpatki2016-05-051-8/+17
| | | | | | | | | | | `validates_acceptance_of` [ci skip] - Improve CHANGELOG entry for #18439. - The documentation is updated as per changes in PR #18439 to the `accept` option. - The explanation about the virtual attribute is moved at the end so that the arity of `accept` option is explained first. - Added a note that `message` can also be passed to `validates_acceptance_of`.
* Update example of passing a proc to `:message` option for validating records ↵Prathamesh Sonpatki2016-04-061-4/+4
| | | | | | | | | | [ci skip] - This change is made as the behavior for `:message` proc was changed in https://github.com/rails/rails/pull/24119. - Also check https://github.com/rails/rails/pull/24431#issuecomment-206106790 for reference.
* [ci skip] Fix variable nameArthur Vieira2016-04-041-2/+2
|
* [skip ci] Update `numericality` validation docsArkadiusz Fal2016-03-281-0/+2
| | | | Add `:other_than` option documentation.
* [ci skip] Added missing custom context validationVijay Kumar Agrawal2016-03-241-0/+19
|
* Fix small typo in Rails guides [ci skip]Mehmet Emin İNAÇ2016-02-151-1/+1
|
* Introduce ApplicationRecord, an Active Record layer supertypeGenadi Samokovarov2015-12-161-54/+54
| | | | | | | | | | | | | | | | It's pretty common for folks to monkey patch `ActiveRecord::Base` to work around an issue or introduce extra functionality. Instead of shoving even more stuff in `ActiveRecord::Base`, `ApplicationRecord` can hold all those custom work the apps may need. Now, we don't wanna encourage all of the application models to inherit from `ActiveRecord::Base`, but we can encourage all the models that do, to inherit from `ApplicationRecord`. Newly generated applications have `app/models/application_record.rb` present by default. The model generators are smart enough to recognize that newly generated models have to inherit from `ApplicationRecord`, but only if it's present.
* Merge pull request #22427 from eliotsykes/validation-message-proc-docYves Senn2015-11-301-1/+30
|\ | | | | | | Document message validation option accepts Proc [ci skip]
| * Document message validation option accepts ProcEliot Sykes2015-11-271-1/+30
|/
* remove deprecated `:tokenizer` option from guide [ci skip]yuuji.yaginuma2015-11-071-15/+0
| | | | `:tokenizer` option was deprecated in 1c341eb7cbaeb52435f14c2595e391bfb2e5e38b
* Merge pull request #20795 from benjiwheeler/validation_guide_ret_valSean Griffin2015-10-201-7/+15
|\ | | | | activerecord guide: clarified roles of valid method and errors object [ci skip]
| * activerecord guide: clarified roles of valid method and errors object [ci skip]Ben Wheeler2015-07-081-7/+15
| |
* | Replace `#=>` with `# =>` [ci skip]amitkumarsuroliya2015-09-191-1/+1
| | | | | | | | @rafaelfranca suggested in https://github.com/rails/rails/commit/f7c7bcd9c2a8b0e8c2840295d001d2d4dfd4cfae that code examples should display the result after `# =>` and not after `#=>`.
* | Merge pull request #20897 from lukechesser/guide-fix-for-acceptance-validationArthur Nogueira Neves2015-09-141-3/+7
|\ \ | | | | | | Update Validation guide for acceptance method
| * | Update validation guide for acceptance methodLuke Chesser2015-07-161-3/+7
| |/
* | Updated MySQL documentation link to MySQL latest version 5.7 everywhere [ci ↵amitkumarsuroliya2015-09-101-1/+1
| | | | | | | | | | skip] Bumps from `5.6` to `5.7`
* | Merge pull request #17351 from akshat-sharma/masterRafael Mendonça França2015-09-011-0/+10
|\ \ | |/ |/| | | Add case_sensitive option for confirmation validation
| * Add case_sensitive option for confirmation validationAkshat Sharma2015-09-011-0/+10
| | | | | | | | | | | | | | Case :- 1. In case of email confirmation one needs case insensitive comparison 2. In case of password confirmation one needs case sensitive comparison [ci skip] Update Guides for case_sensitive option in confirmation validation
* | docs, clarify the meanaing of return values from validation methods.Yves Senn2015-07-071-2/+3
| | | | | | | | | | | | | | | | | | | | [ci skip] Closes #20792. Custom validation methods are implemented in terms of callbacks. The `validate` callback chain can't be halted using return values of individual callbacks.
* | removed erroneous line. Corrected presence validation example.Jurnell Cockhren2015-05-281-1/+0
| | | | | | | | | | Addresses #20343. Removes erroneous line of code in the sample codeblock.
* | Updated postgresql documentation link to use latest version [ci skip]Ronak Jangir2015-05-201-1/+1
| |
* | [ci skip] add to doc that acceptance validator allows `nil` by defaultRoque Pinel2015-05-191-0/+1
| |
* | [ci skip] Improve grammar/syntax in AR validations docs.Tim Wade2015-05-161-12/+12
| |
* | [ci skip] Uniquiness with scope can have one or more argumentsAngelo Capilleri2015-05-031-1/+1
| |
* | [ci skip] Active Record Validations guide fixesJon Atack2015-03-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove deprecated `[]=` - Fix duplicate `errors#add` example. The second code example was originally `[]=`, replace it with `[] <<`. - Improve explanations for `errors#add` and `errors#full_messages` Follow-up to PR #19457 (closed after borking my git history). Apologies for the duplicate PR. cc @kaspth
* | [ci-skip] correct doc about custom validatorsAditya Kapoor2015-02-271-2/+2
| |
* | Oops :bomb:Rafael Mendonça França2015-02-201-1/+1
| |
* | Change the deprecation messages to show the preferred way to work withRafael Mendonça França2015-02-201-1/+1
| | | | | | | | ActiveModel::Errors
* | use `messages` instead of deprecated `ActiveModel::Errors#[]=` method [ci skip]yuuji.yaginuma2015-02-201-1/+1
| |