Hey there,
I have used polymorphic associations to model different types of
questions (multiple choice, simple text, etc.) I want to allow users to
create these questions and chose a type to enter the specific data ( max
text length for text fields, options for multiple choice questions,
etc.)
How do I get to the errors of these question type subclasses?
This way, see 2. line, it does not work…
<%= error_messages_for :question %>
<%= error_messages_for :question.resource %>
<% form_for :question, @question, :url => {:action => :new, :survey =>
@survey} do |form| %>
<%= _( "Question" ) %> <%= form.text_field :text %>
<% fields_for :comment_question, @question.resource do
|comment_question| %>
<%= _( "Size" ) %> <%= comment_question.select :size, CommentQuestion::COMMENT_SIZE_OPTIONS %>
<% end %><%= submit_tag _( "Create Question" ) %>
<% end %>Does anybody have an idea of how to show the errors for the resource
objects?
(In this example, the CommmentQuestion of course has a
validates_inclusion_of :size in it!)