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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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