jorgemanrubia / forceps Goto Github PK
View Code? Open in Web Editor NEWCopy active record models from remote databases
License: MIT License
Copy active record models from remote databases
License: MIT License
I guess it is judging by the age of the last commit
When I am trying Forceps.configure, I have like 15 models but I am getting messages for only 10 models i.e
DEBUG : Classes handled by Forceps: ["Delayed::Backend::ActiveRecord::Job", "PaperTrail::Version", "Role", "AdminUser", "User", "UserAttribute", "Plan", "Tag", "Question", "ActiveAdmin::Comment"]
We're running into the issue where polymorphic STI associations do not work correctly. Here is an example, taken from the tests. I've converted project_id
on LineItem to subject_id
and subject_type
, giving us:
class LineItem < ActiveRecord::Base
belongs_to :subject, :polymorphic => true
end
class Product < ActiveRecord::Base
has_many :line_items, :as => :subject
end
However, when I try to load a generated LineItem's subject
, I get:
#<RemoteLineItem id: 1, quantity: nil, subject_id: 3, invoice_id: nil, created_at: "2014-08-14 22:48:42", updated_at: "2014-08-14 22:48:42", subject_type: "Cars::German::SportsCar">
#<Forceps::Remote::LineItem id: 1, quantity: nil, subject_id: 3, invoice_id: nil, created_at: "2014-08-14 22:48:42", updated_at: "2014-08-14 22:48:42", subject_type: "Cars::German::SportsCar">
# But if I ask the Forceps::Remote::LineItem about its subject_type, I get Forceps::Remote::Cars::German::SportsCar due to reference_remote_class_in_polymorphic_association. But if I ask it for subject, I get:
ActiveRecord::RecordNotFound: Couldn't find Forceps::Remote::Cars::German::SportsCar with id=3 [WHERE "products"."type" IN ('Forceps::Remote::Cars::German::SportsCar')]
Which makes sense because the type in the remote db would be Cars::German::SportsCar
. Do I need to copy the subject first, then somehow update reference_remote_class_in_polymorphic_association
and make_type_attribute_point_to_local_class_if_needed
?
Hiya, awesome looking gem. How hard do you think it would be to support multiple remotes? Our app connects to a bunch of databases:
class OtherModel < ActiveRecord::Base
establish_connection 'other_database'
end
I'm getting following error right after calling Forceps.configure
:
NoMethodError: undefined method `reflections=' for #<Class:0x007fa9dced9e18>
Rails 4.1. Any suggestions?
I use Rails 5. When I run Forceps.configure
I get ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
. I get this error before or after adding the remote
node to database.yml
.
The forceps
gem does not recognize many-to-many association and skips the model while copying.
class Cat < ActiveRecord::Base
has_and_belongs_to_many :family_members
end
class FamilyMember < ActiveRecord::Base
has_and_belongs_to_many :cats
end
When we try to access Forceps::Remote::Cat
it raises the error:
NameError: uninitialized constant Forceps::Remote::Cat
Hi there,
I'm getting an error when calling Forceps.configure
NameError: uninitialized constant Forceps::Remote::Product_FramePhoto
The class is Product::FramePhoto, do I have something configured incorrectly or does forceps not support namespaced models?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.