Hi!
I’m trying to implement localization using inheritance, i.e.:
class ParentController < ApplicationController
layout “mylayout”
def initialize
#do something
end
def index
#do something
end
def search
#do something
end
…
end
Controller do his job and render page using “mylayout” and views from
“/view/parent” folder. After that, I implemented another controller:
class ChildController < ParentController
layout “mylayout”
def initialize
super
#optionally do something more
end
def index
super
#optionally do something more
render :template => “parent/index”
end
def search
super
#optionally do something more
render :template => “parent/search”
end
…
end
This method works fine. Since I only have few things that need to be
shown differently, in child controller I change and/or add them and I
get just what I wanted. However, for every method I used in
ParentController I must have one in ChildController which says what view
to use for rendering (since both controllers work with same views). My
question is: is there a way to tell Rails that my ChildControllers views
are those in “/view/parent” folder, so that I don’t have to implement
methods that only have
super
render :template => “parent/…”
lines?
Thanks in advance!