I'm writing a module to add functionality to the FlagShihTzu gem.
Basically it goes through the flags and outputs the keys for the ones assigned to the object. It's working, but I also want to be able to use a block in the view to do things with the output.
The problem is that it's outputting both the array from the module and the output from the block in the view.
module AwesomeFlags
def my_flags(column = nil)
a = self.flag_mapping
if column.nil?
c = a.values.map {|var| var.keys}.flatten
else
b = a[column]
c = Array.[](b.keys).flatten
end
c.map {|var| self.send(var) ? "#{var.to_s} " : nil}.compact!
end
end
In the view:
= book_offer.my_flags.each do |flag|
= flag.titleize
What I get is:
Regular Complimentary regular complimentary