Sha256: 5ba80c9fbd88f5da07feab01934bd18bed73aeaa5db1dfa535ef41de5b7909a9
Contents?: true
Size: 868 Bytes
Versions: 24
Compression:
Stored size: 868 Bytes
Contents
module KepplerCapsules class CapsuleField < ApplicationRecord include KepplerCapsules::Concerns::StringActions include KepplerCapsules::Concerns::GeneratorActions belongs_to :capsule validates_presence_of :name_field before_validation :convert_to_downcase, :without_special_characters def destroy_migrate delete_field_pg_table("keppler_capsules_#{self.capsule.name}", self.name_field) system('rake keppler_capsules:install:migrations') system('rake db:migrate') end def formats [ :string, :text, :integer, :float, :decimal, :date, :boolean, :association ] end private def convert_to_downcase self.name_field.downcase! end def without_special_characters self.name_field.gsub!(' ', '_') special_characters.each { |sc| self.name_field.gsub!(sc, '') } end end end
Version data entries
24 entries across 24 versions & 1 rubygems