On Mon, Oct 28, 2013 at 7:33 AM, Jordon Bedwell <envygeeks@gmail.com> wrote:
> In Ruby a blank string is a null note a null bit so you need if you
That should say "In Ruby a blank is not a null bit."
> set :default => "" it will allow blank strings, which means your model
> needs to validate with :allow_blank => false or you need to set the
> ALLOW NULL 0 on the field by doing `:null => false` without the
> ":default => true".
>
> The preferable solution from both a security and a proper application
> standpoint is to do tell both the model and the db that it doesn't
> want null or blank strings because a db error should protect against
> manual entries and the model would be quicker when testing for blank
> strings, you can do that with "validates :field, :allow_blank =>
> false, allow_nil => false"
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAM5XQny_v4YzT3yMnZNmWkbjKr4pWjh0NftZHz6Xhi4jcSg33Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment