Controller Delivery:

def create
    @customer = Customer.find(params[:customer_id])
    @delivery = @customer.deliveries.build(params[:delivery])
    @document = @customer.build_document(params[:document])
    if @delivery.valid? and @document.valid?
      Delivery.transaction do
        @delivery.save!
        @document.save!
      end
      flash[:success] = "Consegna effettuata."
      respond_with(@customer)
    else
      @products = Product.all
      render 'customers/show', :layout => 'delivery'
    end
  end

When @delivery and @document are saved it redirects to customer show.
I do customer show also at application startup, after a search.
How can I know if the show is a redirect from Delivery create?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to