This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddVirtualColumnIndexToAhoyEvents < ActiveRecord::Migration[6.0] | |
def up | |
ActiveRecord::Base.connection.execute ( | |
'ALTER TABLE ahoy_events ADD properties_id INT AS (JSON_UNQUOTE(properties->"$.id")) STORED;' | |
) | |
ActiveRecord::Base.connection.execute ( | |
'ALTER TABLE ahoy_events ADD INDEX (properties_id);' | |
) | |
end | |
def down |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%# app/views/layouts/application.html.erb %> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- add this new application.js --> | |
<%= javascript_pack_tag 'application' %> | |
</head> | |
<body> | |
<%= yield %> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* app/javascript/packs/application.js */ | |
require("@rails/ujs").start(); | |
require("@rails/activestorage").start(); | |
require("packs/example1"); | |
require("packs/example2"); | |
require("packs/example3"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* app/javascript/packs/example2.js */ | |
// to call example1 var, you need: | |
import example1 from './example1'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* app/javascript/packs/example1.js */ | |
var example1 = function doSomething() { | |
// Your codes here | |
} | |
export default example1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* app/javascript/packs/application.js */ | |
require("@rails/ujs").start(); | |
require("@rails/activestorage").start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/webpack/production.js | |
process.env.NODE_ENV = 'production'; | |
const environment = require('./environment'); | |
module.exports = environment.toWebpackConfig(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/webpack/loaders/erb.js | |
module.exports = { | |
test: /\.erb$/, | |
enforce: 'pre', | |
exclude: /node_modules/, | |
use: [{ | |
loader: 'rails-erb-loader', | |
options: { | |
runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/webpack/loaders/custom_loaders.js | |
module.exports = { | |
test: /\.ya?ml$/, | |
loaders: ['json-loader', 'yaml-loader'] | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "webpacker" |
NewerOlder