Displaying 2 results from an estimated 2 matches for "errors_messages_for".
Did you mean:
error_messages_for
2006 May 03
1
error_messages_for when saving within another model
Hi,
I have this save routine:
def customer_address_create
customer_options
@customer = Customer.find(params[:id])
@customer.addresses.create(params[:address])
@saved = @customer.save
end
That passes to a rjs template like this:
if @saved
page.visual_effect :Fold, ''add_address''
page.replace_html ''addresses'', :partial =>
2006 Mar 16
0
validating presence of a tag
...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])
flash[:notice] = "Thank you. Your question has been
added."
redirect_to edit_url(@qu...