Displaying 1 result from an estimated 1 matches for "acts_as_optional".
2006 Jun 30
0
Three ActiveRecord features we want at work - any comments/suggestions?
...veyResult.find(:first)
puts sr.survey_results_name.name
sr.survey_results_name.name = ''William''
Now I''ve sort of dreamed up syntax for this, along the lines of:
class SurveyResult < ActiveRecord::Base
#has_one :survey_result_name # get rid of this
acts_as_optional :name
end
sr = SurveyResult.find(:first)
sr.name = ''William''
sr.name_status
=> :present
sr.name_missing :requested_deleted
sr.name_status
=> :requested_deleted
The *_status and *_missing methods I suppose you can create easy
enough in the acts...