Hi,
Can anyone take a look at this.... i've been banging my head on the
wall for several days trying to figure this out. I can't figure out why
the validation is bypassed. The only clue I have is it seems its not
evaluating :question_type == "standard" to true.
Model:
validates :question_type, :presence => true
if :question_type == "standard"
validates :question, :presence => true
...
Controller:
def create
@question = Question.new(params[:question])
if @question.save
if params[:question_type] == "standard"
flash[:success] = "Question created!"
redirect_to @question
else
.....
new.html.erb:
<%= f.submit 'Save', question_type: "standard" ...
--
Posted via
http://www.ruby-forum.com/.