У меня есть некоторые методы контроллера, которые я хотел бы поделиться. Какова наилучшая практика для этого в рубине на рельсах? Должен ли я создавать абстрактный класс, который расширяют мои контроллеры, или я должен создать модуль и добавить его в каждый контроллер? Ниже приведены методы контроллера, которыми я хочу поделиться:
def driving_directions
  @address_to = params[:address_to]
  @address_from = params[:address_from]
  @map_center = params[:map_center_start]
  # if we were not given a center point to start our map on
  # let create one.
  if [email protected]_center && @address_to
    @map_center = GeoKit::Geocoders::MultiGeocoder.geocode(@address_to).ll
  elsif [email protected]_center && @address_from
    @map_center = GeoKit::Geocoders::MultiGeocoder.geocode(@address_from).ll
  end
end
def printer_friendly
  starting_point = params[:starting_point].split(',').collect{|e|e.to_f}
  ne = params[:ne].split(',').collect{|e|e.to_f}
  sw = params[:sw].split(',').collect{|e|e.to_f}
  size = params[:size].split(',').collect{|e|e.to_f}
  address = params[:address]
  @markers = retrieve_points(ne,sw,size,false)
  @map = initialize_map([[sw[0],sw[1]],[ne[0],ne[1]]],[starting_point[0],starting_point[1]],false,@markers,true)
  @address_string = address
end