Hey

On Tue, Jun 25, 2013 at 8:06 PM, James Pinto <tap...@gmail.com> wrote:

> I understand where you're coming from,
> and I completely disagree
>
> false is blank, but it's not nil,
>
Well I think since it is a value, it should not be considered blank.


> however, in some cases, falseness should not be validated
>
And in some cases, it might be required to be validate that. This is a case
to case approach and for some people a certain set of cases might be
relevant while another set of cases might be relevant for some others.
After I posted this issue, I have encountered another issue in our system
related to this. So, for my setup the validation makes sense.


>
> "validates_presence_of :aggrees_with_contract"* is correct, requires the
> user to check the contract*
> "validates_presence_of :displays_photo_for_guests" *is incorrect, because
> it's only a question and it's ok if the user forgets or chooses not to mark
> *
>
>
> [false, nil].map &:blank?
> => [true, true]
> [false, nil].map &:present?
> => [false, false]
> [false, nil].map &:nil?
> => [false, true]
>

Please refer to http://intosimple.blogspot.**in/2013/05/rails-falsepresent-*
*being-false-is-not.html for a sample case. The above example is obvious
from the source code investigation I provide in the link.

Regards,
Amitav

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to