Commit Graph

30 Commits

Author SHA1 Message Date
Takehiro Adachi
740f7787e0 Fix active_record_validations.md document, :save for on: validation helper was never available
According to the guide, ":save" value for the "on:" validation helper
was available like below

    validates :name, presence: true, on: :save

but this was never available according to the implementation of the
valid? method, which is below

    # Runs all the validations within the specified context. Returns
+true+ if
    # no errors are found, +false+ otherwise.
    #
    # If the argument is +false+ (default is +nil+), the context is set
to <tt>:create</tt> if
    # <tt>new_record?</tt> is +true+, and to <tt>:update</tt> if it is
not.
    #
    # Validations with no <tt>:on</tt> option will run no matter the
context. Validations with
    # some <tt>:on</tt> option will only run in the specified context.
    def valid?(context = nil)
      context ||= (new_record? ? :create : :update)
      output = super(context)
      errors.empty? && output
    end

So the documentation was always wrong since the PR proposed by
@neerajdotname  ( #10287 ) was rejected.
2013-08-04 18:37:12 +09:00
Yves Senn
20281b7f39 fix typo in Active Record Validations guide. [ci skip].
Closes #11498.
2013-07-19 07:44:53 +02:00
Rashmi Yadav
11cae34701 [doc] Update return false if record is invalid 2013-06-19 19:01:33 +02:00
Vijay Dev
41a398f859 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/upgrading_ruby_on_rails.md
2013-06-14 01:14:56 +05:30
Rashmi Yadav
ad694f2f26 Using 1.9 syntax for edge guides 2013-06-12 23:04:40 +02:00
barelyknown
5c1a2cf6b3 change format example to read better when rendered with full_messages
The capital O was awkward and the validation wouldn't read "right" to the user.
2013-06-08 12:36:53 -04:00
Sunny Ripert
53607be559 Remove double spaces in guides 2013-05-28 14:38:02 +02:00
Sunny Ripert
666d028bb8 End-of-line whitespace hunt 2013-05-28 14:38:01 +02:00
Radu Busuioc
5554775980 Corrected documentation regarding validation errors 2013-05-16 18:46:00 +01:00
aditya-kapoor
73fece000f Added instructions of latest bundler install + modified the on: :save option description in validations 2013-04-22 16:16:44 +05:30
aditya-kapoor
d2a799895b corrected a typo related to on: :save option in validations 2013-04-22 15:26:29 +05:30
aditya-kapoor
9616849ccb corrected a line related to on: :save option in validations 2013-04-22 15:21:10 +05:30
Zoltan Debre
ffde34d510 Change 'validates_presence_of' to 'presence: true'
Of course validates_presence_of is still working but it is not explained in the guide, I think consequently should use 'presence: true' in this documentation.
2013-04-16 00:56:12 +02:00
Angelo capilleri
74c3b7f6f6 fix absence validator doc for boolean field 2013-03-13 14:18:37 +01:00
Angelo capilleri
8b3483f0a8 absence validator doc 2013-03-13 14:15:15 +01:00
Henrik Nyh
045f0195e0 Validations guide: validates_with init clarification.
As discussed with @josevalim on Ruby Rogues Parley.
2013-02-09 15:47:22 +01:00
Anton Cherepanov
31143a4ad3 Update guides/source/active_record_validations.md
Duplicated `update`
2013-01-15 22:54:21 +06:00
Amparo Luna + Guillermo Iguaran
03ac174f2d Change guides to use update instead of update_attributes 2013-01-03 12:04:25 -05:00
Colin Kelley
52691c369c removed TIP: :allow_nil/:allow_blank is ignored by the presence validator
These tips were documenting an inconsistency issue https://github.com/rails/rails/issues/8621. That issue is resolved by https://github.com/rails/rails/issues/8622.
2012-12-26 17:02:54 -08:00
Steve Klabnik
8832313ebb Restored 'Working with Validation Errors'
Somehow this got lost in my PRs before. I'm going to re-check all the
guides to make sure this didn't happen again elsewhere.
2012-12-16 11:08:13 -05:00
Vijay Dev
561e5ab82e copy editing [ci skip] 2012-12-15 21:15:05 +05:30
Jay Hayes
948c1e506c Elaborate using inverse_of with presence validation 2012-12-13 14:04:21 -06:00
Jay Hayes
d5badea28c Fix associations presence lost in steve's reformat
55a2820cc6
messes up
cfd324b4b6

Hopefully there is other stuff lost in translation...
2012-12-13 13:58:49 -06:00
Vijay Dev
0a33fcd68b Merge branch 'master' of github.com:lifo/docrails 2012-12-08 23:11:37 +05:30
Katie Oldaker
fc6336d1be Punctuation, capitalization, grammar fixes in rails guides 2012-12-07 16:32:06 -05:00
Katie Oldaker
7c05ea23a0 Fixed grammar in a lot of guide prologues. 2012-12-07 12:50:09 -05:00
Carlos Antonio da Silva
129eac0243 Fix Active Record validation error messages markup in guides
The other way it was not marking the text as italic, it was showing the
underlines as normal text.

Also fixes some code examples indentation and # => marks in Active Model
and Active Record guides.

[ci skip]
2012-12-04 21:05:44 -02:00
Steve Klabnik
55a2820cc6 Here's a few updates to the validations guide. A bunch of small changes,
plus:

* 80 column formats
* replacing the explanation of the dynamic_form gem with the example
  HTML/CSS that Rails scaffolds generate.
2012-12-01 10:25:16 -08:00
Vijay Dev
0181c2da97 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/active_record_validations.md
2012-12-01 23:00:47 +05:30
Steve Klabnik
b659e00baf Split Validations and Callbacks into separate guides.
Two big features that are only barely related in the same guide. Seems
bad.

I did not check references to these guides yet, so some links may need
to be updated.
2012-11-29 15:03:21 -08:00