I'm trying to get my virtual attribute that is a boolean to work. In this example, lets call the virtual boolean field children
:
models/parent.rb
Parent
attr_accessible :children
attr_accessor :children
validates_inclusion_of :children, :in => [true, false]
def self.children=(boolean)
end
end
parents/new.html.erb
<%= form_for @parent do |f| %>
<%= f.check_box :children %>
<%= f.submit "Create" %>
<% end %>
Right now when I try to use it, (create a parent) it gives me the error
Children is not included in the list
when the validation comes up.
How do I write this?