In an action called index I have some code that grabs some objects from the
database to populate a select form helper. This works great.
Problem is that if I try to save the form generated by the index action and
validation fails, I run into trouble.
My save process looks like this:
if @new_release.save
    redirect_to :action => ''create_tracks''
else
    render :action => ''index''
end
If validation fails and render gets called, Rails attempts to render the
template for index without calling the action, which gives a 500 because the
select form helper doesn''t have any data (the data is fetched in the
index
action).
If I do a redirect instead of a render it seems to each anything in the
flash, including my error messages.
So, what is the best practice here?
Thx.
In an action called index I have some code that grabs some objects from the
database to populate a select form helper. This works great.
Problem is that if I try to save the form generated by the index action and
validation fails, I run into trouble.
My save process looks like this:
if @new_release.save
    redirect_to :action => ''create_tracks''
else
    render :action => ''index''
end
If validation fails and render gets called, Rails attempts to render the
template for index without calling the action, which gives a 500 because the
select form helper doesn''t have any data (the data is fetched in the
index
action).
If I do a redirect instead of a render it seems to each anything in the
flash, including my error messages.
So, what is the best practice here?
Thx.