I have a model with a boolean variable in the database and one added by 
attr_accessor:
In the model:
  attr_accessor :attrvalue
  validates(:dbvalue, inclusion: { in: [true, false], message: "%{value} is
not a valid response"} )
  validates(:attrvalue, inclusion: { in: [true, false], message: "%{value} 
is not a valid response"} )
In the view:
    <%= form_for(@user) do |f| %>
      <%= f.select :dbvalue, {'' => nil, 'Yes' => true,
'No' => false},
{},  { :class => 'span1' } %>
      <%= f.select :attrvalue, {'' => nil, 'Yes' =>
true, 'No' => false},
{},  { :class => 'span1' } %>
    <% end %>
The dbvalue works, the attrvalue does not work and always throws the 
message attrvalue is not a valid response.
I assume that attrvalue is not a boolean. Can I force it to be a boolean? 
Alternately, is there another way to handle it?
-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/da31f697-71b5-413e-ac7e-6685037aea51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.