def campaigns
get_calculate_stats(Campaign)
render 'stats'
end
def sources
get_calculate_stats(Source)
render 'stats'
end
def offers
get_calculate_stats(Offer)
render 'stats'
end
module Bar
%w{one two three}.each do |n|
define_method n do
super()
print " BAR"
end
end
end
class Foo
prepend Bar
def one
print '1'
end
def two
print '2'
end
def three
print '3'
end
end
Foo.new.one # 1 BAR
Foo.new.two # 2 BAR
Foo.new.three # 3 BAR
after_action :render, only: [:campaigns, :sources, :offers]