views:

38

answers:

1

I have created a common controller for my application.

class CommonController < ApplicationController
  def index 
   # My stuff
  end
end

And in my other controller i am using super to call my index method like this.

class Other1Controller < CommonController
  def index
    super
  end
end

class Other2Controller < CommonController
  def index
    super
  end
end

This is working fine.

Now in my class i have two method index and index1.

class Other1Controller < CommonController
  def index
    super
  end

  def index1
    super(index) # Can i pass method inside super to override this method with my 
                 # common index method.
  end
end

Is there any way ? can i pass method with super to override my method with specific method?

+5  A: 

Why not just call index?

class Other1Controller < CommonController
  def index
    super
  end

  def index1
    index
  end
end
mipadi