Module: MmunicodeRails::ActiveRecordMacro::ClassMethods

Defined in:
lib/mmunicode_rails.rb

Instance Method Summary collapse

Instance Method Details

#mmunicode_convert(*fields) ⇒ Object



246
247
248
249
250
251
252
253
254
255
256
257
258
259
# 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