Validating Multiple Models
The problem is that when I use error_messages_for to display validation errors for two models, only the parent model's validation is displayed and not for the relationships. Example.
class Resource < ActiveRecord::Base
has_one :setting
end
class Setting < ActiveRecord::Base
belongs_to :resource
end
If I do:
@resource = Resource.new
@resource.settings = Settings.new
@resource.save!
Only Resource's validation shows up and not Setting's. Is there anyway that I can validate the relationships of a model?
*ANSWER*
"if model1.valid? and model2.valid? and model3.valid?
save model data"
People succeed in answering Don Miguel de los Platanos's questions 42% of the time (8 successes in 19 attempts).