Questions tagged [amoeba-gem]

Anything related to Amoeba ruby gem for easy cloning of ActiveRecord objects

Amoeba is a ruby gem to allow the copying of ActiveRecord objects and their associated children including associations and several operations under associations and attributes.

15 questions
4
votes
0 answers

What replaces amoeba gem beyond Rails 5.1

It appears that the Amoeba gem is no longer being maintained since late 2017 and the readme only claims compatibility with Rails thru version 5.1 Has anybody figured a best path for deep copies, including associations, for Rails 5.2 and beyond?
greg
  • 41
  • 2
3
votes
0 answers

Rails cloning with amoeba gem

I'm having issues with the referencing of a specific model when being cloned. I've tried using multiple approaches but none have gotten the correct result, and I believe it has to do with me not understanding how the logic of cloning works. This…
Waclock
  • 1,686
  • 19
  • 37
3
votes
0 answers

Duplication of models with multiple nested & non-nested belongs_to relationships

Apologies if the title isn't accurate, I had a difficult time distilling this question into a single line. I'm using the amoeba gem and trying to figure out if it's possible to associate a duplicated model with multiple belongs_to relationships.…
Eric Norcross
  • 4,177
  • 4
  • 28
  • 53
3
votes
3 answers

How to copy images using amoeba gem in rails?

I am using amoeba gem for duplicating record and i am using carrierwave for uploading images. I tried to copy the images from the associated model using amoeba, it only copies the data from the original record(it copies only icon name,file…
Mano
  • 979
  • 1
  • 18
  • 36
2
votes
1 answer

Rails amoeba gem doesn't copy many-to-many relation

I have a problem with copying database records. I have a simple model User, that contains one-to-many relation with Language model and many-to-many relation with Skill model. I wanted to use amoeba gem to copy records with all associations.…
1
vote
1 answer

Rails 4 Duplicating Model Objects and Merging New Object attribtues (Amoeba Gem)

What I'm doing: Duplicating a record of my Project model then overwriting the modified attributes from an object submitted by a form. The new record should be modified but have all the associations as the original. The first step I took was to…
1
vote
1 answer

Ruby on Rails + Amoeba Gem: undefined method 'macro'

I tried amoeba version 2.0.0 in the Rails console (with Ruby 2.1). This is my model: class Dict < ActiveRecord::Base belongs_to :user has_many :cards, dependent: :destroy has_many :idioms, through: :cards end class Card < ActiveRecord::Base …
user1934428
  • 19,864
  • 7
  • 42
  • 87
0
votes
1 answer

Skip callbacks in amoeba gem while cloning

Consider a basic structure with class A has many B. Now while cloning A object, I want to skip callbacks of object B. How to do that? We generally do this using attr_accessor but I unable to do that…
0
votes
1 answer

undefined method `amoeba' rails 5.2

I'm following this tutorial for implementing a bookingsystem to my rails app. I'm currently stuck, because when I hit the 'New booking' button I get this error undefined method `amoeba' for # ![NoMethodError in…
kvnirvana
  • 71
  • 1
  • 8
0
votes
1 answer

Rails + Amoeba error: Uninitialized constant

I need to clone a model in my Rails application and I am using amoeba gem to do the same. class Quiz belongs_to :scoring belongs_to :skill has_many :questions, :dependent => :destroy has_many :attempts, :dependent => :destroy has_many…
Lax_Sam
  • 1,099
  • 2
  • 14
  • 32
0
votes
2 answers

amoeba not cloning all :has_many associations

I am using the Amoeba gem to clone a model and all children. The gem is working well with one exception - there is one :has_many association that is not being picked up. My parent Model is Option: class Option < ActiveRecord::Base has_many…
Gpcnec76
  • 69
  • 1
  • 8
0
votes
1 answer

Using Amoeba to copy a page with blocks and contents

I have the following model for my Pages in my rails app: class Page < ActiveRecord::Base has_many :blocks has_many :contents, :through => :blocks validates :title, presence: true validates :content, presence: true validates…
Cameron
  • 27,963
  • 100
  • 281
  • 483
0
votes
1 answer

Duplicating record isn't duplicating image

I'm trying to duplicate my record and using the amoeba gem. Everything copies fine except for the image (which is uploader via carrierwave) For the image I tried doing a customized setting in amoeba like this: amoeba do customize(lamba {…
DRing
  • 6,825
  • 6
  • 29
  • 45
0
votes
1 answer

Set current_user.id in association (duplicate using amoeba)

I have a Tasklist & a Task Model. I'm using the gem amoeba to duplicate one task list with its associated tasks. Both Tasklist & Task have a user_id field. The user_id is set to NULL by default. When I duplicate, I want the user_id to be set to the…
Vincent
  • 147
  • 10
0
votes
1 answer

Rails 4, Amoeba Gem inside a Concern

Is it possible to use the Amoeba gem within a Concern? Currently I'm getting this error when I try to run it inside a Concern: undefined method `amoeba' for Amoeba:Module The same code works fine inside the actual models but I want to DRY it up,…