What exactly are you trying to achieve with this approach, why do you need
to have the second attr not in the database and validated?
To answer your question, yes you can force it to be a boolean, by creating
your own accessor methods
Instead of attr_accessor :attrvalue
def attrvalue
The respond_to is a Ruby block statement
respond_to do |format| creates the variable format and calls html or xml on
it
so for each format, carry out some action. In this case, respond to the
http request with the appropriate format(html, xml, json)
respond_to do |format|
format.html
2 matches
Mail list logo