Skip to content

Instantly share code, notes, and snippets.

addBlock: function(state, block) {
// It automatically adds a product block on initial load
// Don't add first block if blocks already exist in db
if (state.blocks.length > 0) {
var blocks = [];
for(var i = 0; i < block.grid_columns_number; i++){
var addBlock = _.cloneDeep(block);
var position = i;
if (!_.isEmpty(_.flatten(state.blocks))) {
@MariaFamador
MariaFamador / database.rake
Created September 3, 2018 08:02
Override db:structure rake task which removes -i option, error stops migration working in mac os
Rake::Task["db:structure:dump"].clear
namespace :db do
namespace :structure do
desc 'Dump the database structure to db/structure.sql. Specify another file with DB_STRUCTURE=db/my_structure.sql'
task :dump => [:environment, :load_config] do
config = current_config
filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, "db", "structure.sql")
case config['adapter']
when /mysql/, 'oci', 'oracle'
ActiveRecord::Base.establish_connection(config)