Displaying 1 result from an estimated 1 matches for "add_question".
Did you mean:
  adamquestion
  
2006 Mar 16
0
validating presence of a tag
..."name") %>
<%= submit_tag %>
<% end_form_tag %>
The question is one model. Tag is another.
My problem is that I can''t figure out how to validate that the user inputs a
tag. He must input both a question and a tag.
My controller method looks something like:
def add_question
    if request.get?
        @question = Question.new
        @tag = Tag.new  #needed this so my errors_messages_for :tag will not
cause error
    else
        @question = Question.new(params[:question])
            if @question.save
                @question.tag(@params[:tag][:name])...