module MmunicodeRails::ActiveRecordMacro::ClassMethods

Public Instance Methods

mmunicode_convert(*fields) click to toggle source
# File lib/mmunicode_rails.rb, line 246
def mmunicode_convert(*fields)
 fields.each do |field|
         field_type = self.columns_hash[field.to_s].type
         unless field_type == :string || field_type == :text then
                 raise NotSupportedForNonStringTypesError.new(field_type),"#{field_type} is not supported.Supported types are :string and :text" 
         end
 end
   before_save do
     fields.each do|field|
       zg = self.send(field.to_sym)
       self.send("#{field}=".to_sym,zg12uni51(zg))
     end
   end
end