merge with staging
This commit is contained in:
@@ -42,6 +42,10 @@ Rails.application.config.assets.precompile += %w( fileinput.min.js )
|
||||
Rails.application.config.assets.precompile += %w( addorder.css )
|
||||
Rails.application.config.assets.precompile += %w( addorder.js )
|
||||
|
||||
# --- Custom SX Themem ----
|
||||
Rails.application.config.assets.precompile += %w( sx-sidebar.css )
|
||||
Rails.application.config.assets.precompile += %w( popper.min.js )
|
||||
|
||||
# --- Inventory Definition ----
|
||||
Rails.application.config.assets.precompile += %w( inventory_definitions.css )
|
||||
|
||||
|
||||
45
config/initializers/mysql2_adapter.rb
Executable file
45
config/initializers/mysql2_adapter.rb
Executable file
@@ -0,0 +1,45 @@
|
||||
module ActiveRecord
|
||||
class Base
|
||||
# Overriding ActiveRecord::Base.mysql2_connection
|
||||
# method to allow passing options from database.yml
|
||||
#
|
||||
# Example of database.yml
|
||||
#
|
||||
# login: &login
|
||||
# socket: /tmp/mysql.sock
|
||||
# adapter: mysql2
|
||||
# host: localhost
|
||||
# encoding: utf8
|
||||
# flags: 131072
|
||||
#
|
||||
# @param [Hash] config hash that you define in your
|
||||
# database.yml
|
||||
# @return [Mysql2Adapter] new MySQL adapter object
|
||||
#
|
||||
def self.mysql2_connection(config)
|
||||
config[:username] = 'root' if config[:username].nil?
|
||||
|
||||
if Mysql2::Client.const_defined? :FOUND_ROWS
|
||||
config[:flags] = config[:flags] ? config[:flags] | Mysql2::Client::FOUND_ROWS : Mysql2::Client::FOUND_ROWS
|
||||
end
|
||||
|
||||
client = Mysql2::Client.new(config.symbolize_keys)
|
||||
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
|
||||
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
|
||||
end
|
||||
end
|
||||
|
||||
# This method is for running stored procedures.
|
||||
#
|
||||
# @return [Hash]
|
||||
#
|
||||
def self.select_sp(sql, name = nil)
|
||||
connection = ActiveRecord::Base.connection
|
||||
begin
|
||||
connection.select_all(sql, name)
|
||||
rescue NoMethodError
|
||||
ensure
|
||||
connection.reconnect! unless connection.active?
|
||||
end
|
||||
end
|
||||
end
|
||||
6
config/initializers/secrets.rb
Executable file
6
config/initializers/secrets.rb
Executable file
@@ -0,0 +1,6 @@
|
||||
# config = YAML.load_file(Rails.root.join("config/smartsales.yml"))
|
||||
# config.fetch(Rails.env, {}).each do |key, value|
|
||||
# ENV[key.upcase] = value.to_s
|
||||
# end
|
||||
|
||||
SECRETS_CONFIG = YAML.load_file("#{Rails.root}/config/secrets.yml")[Rails.env]
|
||||
4
config/initializers/sx.rb
Normal file
4
config/initializers/sx.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
config = YAML.load_file(Rails.root.join("config/sx.yml"))
|
||||
config.fetch(Rails.env, {}).each do |key, value|
|
||||
ENV[key.upcase] = value.to_s
|
||||
end
|
||||
Reference in New Issue
Block a user