Module: Cardio::Seed
- Defined in:
- card/lib/cardio/seed.rb
Overview
methods in support of seeding
Constant Summary collapse
- TABLES =
%w[cards card_actions card_acts card_changes card_references schema_migrations transform_migrations].freeze
Class Method Summary collapse
Class Method Details
.clean ⇒ Object
40 41 42 43 44 |
# File 'card/lib/cardio/seed.rb', line 40 def clean Card::Act.update_all actor_id: clean_history clean_time_and_user_stamps end |
.default_path ⇒ Object
8 9 10 |
# File 'card/lib/cardio/seed.rb', line 8 def default_path db_path Cardio.config.seed_type, 0 end |
.dump ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'card/lib/cardio/seed.rb', line 29 def dump dump_tables.each do |table| i = "000" # TODO: use card keys instead (this is just a label) write_seed_file table do yamlize_records table do |record, hash| hash["#{table}_#{i.succ!}"] = record end end end end |
.load ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'card/lib/cardio/seed.rb', line 20 def load ActiveRecord::FixtureSet.create_fixtures path, load_tables return unless update_seed? Cardio::Migration::Schema.new.assume_current Cardio::Migration::Transform.new.assume_current end |