Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Using a dump script with ActiveRecord models within a Rails app #14

@axsuul

Description

@axsuul

I'm running into issues using a dump script on ActiveRecord objects within a Rails application. Here is my dump script config/replicate/dump.rb

# config/environment
require File.dirname(File.dirname(File.expand_path(__FILE__))) + "/environment"

Post.all.each do |post|
  dump post
end

Running

replicate -d config/replicate/dump.rb > test.dump

gives the error

Post must respond to #dump_replicant (NoMethodError)

Does this mean replicate is somehow not being required? However, I am definitely requiring replicate in my config/environment

# Load the rails application
require File.expand_path('../application', __FILE__)

require 'replicate'

# Initialize the rails application
TestApp::Application.initialize!

What's strange is that this works fine.

replicate -r config/environment -d "Post.all" > test.dump

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions