pgfqe6ch8/app/helpers/wechats_helper.rb

21 lines
558 B

#coding=utf-8
#
module WechatsHelper
def include_wechat_jsfile
if Rails.env.production?
javascript_include_tag '/javascripts/wechat/build/app.min.js'
else
wechat_path = File.join(Rails.root, "public", "javascripts", "wechat")
srcs = Rails.application.config.wechat_srcs
paths = []
srcs.each do |src|
Dir.glob(wechat_path+ "/#{src}" ) do |path|
paths << path[File.join(Rails.root, "public").to_s.size, path.size]
end
end
javascript_include_tag *paths
end
end
end