Polymorphic Associations - Error-Handling?

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,

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
(In this example, the CommmentQuestion of course has a
validates_inclusion_of :size in it!)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs