I guess you use erb for custom scaffolding. create generic_controller.erb
class <%= controller_name %>Controller < ApplicationController
some stuff using erb
end
Then you can evaluate it like
controller_name = 'Something'
ERB.new(File.read('generic_controller.erb')).run(binding())
this will give you
class SomethingController < ApplicationController
some stuff using erb
end
hope this will help you