"[email protected]" <[email protected]> writes:

> Jarl,
> I'm wondering in what context you end up with user input that outputs
> a boolean?
>
> Is it from a web form,
> or XML,
> or JSON
> or  console app?

Integration with an external system making REST calls to our app.

> My feeling is that you're only going to end up with a true/false if
> you are calling from a method inside your application,
> eg.
>
>   something.make_order(params, :balloon => true)
>
> in which case "validation" may be the wrong use case.

Yes, but as in most other rails application, the input comes from a
http POST or PUT method, hence the input is unreliable and validation
is wanted.

> If you're trying to guard against your own input
> then perhaps what you want to invent something like
>
>   guard_field :balloon, :values => [true, false]

I am trying to inform what-ever-have provided-the-input that the value
is not acceptable.

Here is an example A generic web-form, where all input fields are of
type text (in the HTML form), but of course some fields (like
:balloon) are typed, and therefore only certain values are
accepted. The value "sand" (which means 'true' in danish) is not an
acceptable boolean value, hence I would like a validation
message. Currently this would silently be converted to false, which
semantically means the complete opposite of what the user expected.

Jarl

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to