def create

    # next statement is original and is removed
    # @review = Review.new(params[:review])

    @school = School.find(params[:school_id])
    # @review = @school.reviews.create!(params[:review])
    @review = @school.reviews.build(params[:review])


    respond_to do |format|
      if @review.save

        flash[:notice] = 'Review was successfully created.'
        # format.html { redirect_to(@review) }
        format.html { redirect_to(@school) }
        format.xml  { render :xml => @review, :status => :created,
:location => @review }
      else
        # format.html { render :action => "new" }
        format.html { render :action => "new" }  #  <----- HERE
        format.xml  { render :xml => @review.errors, :status =>
:unprocessable_entity }
      end
    end
  end


In this view the line

        format.html { render :action => "new" }

renders the reviews new method when the validation fails...thing is I
want to show the school and the error messages, (schools controller show
method) like this line,  format.html { redirect_to(@school) }.

any help on how to do this?
-- 
Posted via http://www.ruby-forum.com/.

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