Sha256: db928cb6d69526a3696efe69f494a189708bba976628b61b41aed78f24c5519b

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require 'drg_cms/engine'
require 'drg_cms/version'

module DrgCms
  @@paths = {}
################################################################################
# Returns source file name of required model. 
# 
# Used wherever end user wants to extend basic DrgCms model. Model source definition 
# file is tricky to require since it is included in DrgCms gem and thus a moving 
# target. Whenever gem version changes file location changes with it. This way 
# end user doesn't have to care about actual source file location.
# 
# @example 
#   require DrgCms.model 'dc_page'
#   
# @param [ model_name ]. Must be passed in lower case, just like the file name is. 
# 
###############################################################################
def self.model(model_name)
  File.expand_path("../../app/models/#{model_name}.rb", __FILE__)  
end

###############################################################################
# 
###############################################################################
def self.add_form_path(path) 
  if @@paths[:forms].nil?
    @@paths[:forms] = []
# default application forms path
#    @@paths[:forms] << Rails.root.join('app/forms')
# DrgCms forms path
    @@paths[:forms] << File.expand_path("../../app/forms", __FILE__)
  end
  @@paths[:forms] << path  
end

###############################################################################
# 
###############################################################################
def self.paths what
  @@paths[what]
end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
drg_cms-0.4.39 lib/drg_cms.rb