[Rails] Re: Validating a boolean non-database addition to a model

2014-06-08 Thread James Kwame
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

[Rails] Re: confusion on respond_to do |format| execution sequence

2014-01-04 Thread James Kwame
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