L'action create of deliveries controller is:

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] = 'Ok'
     respond_with(@customer)
   else
     @products = Product.all
     render 'customers/show', :layout => 'delivery'
   end
 end

l'action show of customers controller is:

.............
<% content_for :delivery_form do %>
 <%= render 'deliveries/form' %>
<% end %>
<% content_for :delivered do %>
 <%= render 'delivered/form' %>
<% end %>

I want to see only one of the two content_for depending on @delivery
and @document are saved or not.
I have a form, on submit @delivery and @document are created, if they
are not valid I have to see the show view and in the layout I should
see <%= yield :delivery_form %> while if the objects are valid eand
then saved in the database in the layout I should see <%= yield
:delivered %>.
Based on what I can make the selection?

-- 
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