I'm relatively new to Rails and was wondering what the reasoning behind the 
following is:

I have a boolean field processed that I want to set to false by default:

  before_validation(on: :create) do
    self.processed ||= false
  end

  validates :processed, presence: true

This only works if I modify it to the following, which with my knowledge 
don't find intuitive:

  before_validation(on: :create) do
    self.processed ||= false
    true
  end

  validates :processed, inclusion: { in: [true, false] }

Is this a design choice or is it simply too hard too implement 
(Object#blank etc)?

-- 
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 [email protected].
To post to this group, send email to [email protected].
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