Rails4: métodos compartidos por múltiples controladores
Tengo dos controladores, es decir, 1) carts_controller 2) orders_controller
class CartsController < ApplicationController
helper_method :method3
def method1
end
def method2
end
def method3
# using method1 and method2
end
end
Nota:method3
esta usandomethod1
ymethod2
. CartsController
tieneshowcart.html.erb
ver cuál está usando method3 y funciona bien.
Ahora en la vista del pedido, necesito mostrar el carrito (showcart.html.erb
) pero como el ayudantemethod3
se define encarts_controller
entonces no puede acceder a él.
Como arreglarlo ?