mondayguy
mondayguy

Reputation: 991

Rendering both layout and view, rails

I have next mistake: Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect

here

respond_to do |format|
            format.html {
                render layout:"productView"
                render "show2"

            }
          ajax_respond format, :section_id => "user_tab_comments"           
            format.js
        end

So I want to render both layout and view, what am I doing wrong?

Upvotes: 1

Views: 73

Answers (1)

sansarp
sansarp

Reputation: 1466

Use like this instead of double render:

   render :show2, layout: 'productView'

And layout page should be under app/views/layouts/ Hope it works.

Upvotes: 3

Related Questions