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| %>
<p>
<label for="text"><%= _( "Question" )
%></label>
<%= form.text_field :text %>
</p>
<% fields_for :comment_question, @question.resource do
|comment_question| %>
<p>
<label for="size"><%= _( "Size" )
%></label>
<%= comment_question.select :size,
CommentQuestion::COMMENT_SIZE_OPTIONS %>
</p>
<% end %>
<p>
<%= submit_tag _( "Create Question" ) %>
</p>
<% 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!)
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---