In one of my controller methods I need to set a flash[:notice] and
redirect back to the form to show the error.

I have this code:

master_storeids = params[:master_storeid]
if (master_storeids.nil?)

  flash[:notice] = 'No store was is selected'
  redirect_to :action => 'new_data'

followed by the “normal” code that would be proceesed if no error

Problem is that the redirect doesn’t seem to do anything it just
continues on to the remaining code.

I have verified that master_storeids is nil and there is a new_data
method in the controller.


The redirect does do something. Any further attempts at rendering or
redirecting should fail.

To be safe just add a return statement after the redirect to complete
the processing.