Sha256: ba89b6be5cc920b6d57e81b67aa0541a72ffc1f5af51fe7effbd288ece7c6371
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
module LesliBabel class Module < ApplicationRecord has_many :buckets validates_presence_of :platform before_create :format_module_name def self.index Module.where("name is not null") order(id: :desc).map do |translation_module| { id: translation_module[:id], name: translation_module[:name], code: translation_module[:name].downcase, platform: translation_module[:platform] } end end def show { :id => self.id, :code => self.code.titleize, :platform => self.platform, :created_at => self.created_at } end def format_module_name return if self.code == "main_app" return if self.platform == "lesli_core" return if self.platform == "lesli_engine" self.code = self.code .gsub(/[^0-9A-Za-z\s\-\_]/, '') # remove special characters from string .gsub(/-/, '') # replace dashes with underscore .gsub(/_/, '') # replace underscore with underscore .gsub(/\s+/, '') # remove blank spaces end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lesli_babel-0.6.0 | app/models/lesli_babel/module.rb |
lesli_babel-0.5.0 | app/models/lesli_babel/module.rb |
lesli_babel-0.4.0 | app/models/lesli_babel/module.rb |