This project is archived and is in readonly mode.

#4771 ✓wontfix
Jan Lelis

defining initialize for a controller causes that no layout is rendered

Reported by Jan Lelis | June 4th, 2010 @ 10:44 PM

Defining initialize for a controller causes that no layout is rendered, except it is passed as option for render. It is probably not intended (filters), but was possible in Rails 2.

class EntriesController < ApplicationController
  layout 'some_layout' # or 'application' or none

  def initialize
    :blubb
  end

  # does not work:
  def show
  end

  def index
    render :action => 'index'
  end

  # does work
  def new
    render :action => 'new', :layout => 'some_layout'
  end

  # ...

Comments and changes to this ticket

  • Ryan Bigg

    Ryan Bigg June 5th, 2010 @ 04:15 AM

    • State changed from “new” to “wontfix”

    initialize is an important method for controllers in Rails 3. Do not override this method.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages