Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration created #137

Closed
drkmen opened this issue Mar 1, 2019 · 3 comments · Fixed by #164 · May be fixed by #165
Closed

migration created #137

drkmen opened this issue Mar 1, 2019 · 3 comments · Fixed by #164 · May be fixed by #165

Comments

@drkmen
Copy link

drkmen commented Mar 1, 2019

Hello!
Running the command rails g active_admin:install creates db/migrate/20190301091416_create_active_admin_comments.rb

Rails 5.1.4
ruby 2.5.1

activeadmin (1.4.3)
      arbre (>= 1.1.1)
      coffee-rails
      formtastic (~> 3.1)
      formtastic_i18n
      inherited_resources (>= 1.9.0)
      jquery-rails (>= 4.2.0)
      kaminari (>= 0.15)
      railties (>= 4.2, < 5.3)
      ransack (>= 1.8.7)
      sass (~> 3.1)
      sprockets (< 4.1)
    activeadmin-mongoid (0.7.0)
      activeadmin (>= 1.3.0)
      jquery-rails
      mongoid (~> 6.0)
      sass-rails (>= 3.1.4)
@boie0025 boie0025 added the bug label Apr 15, 2019
@boie0025
Copy link
Member

I took a swing at this tonight:

# lib/activeadmin-mongoid.rb
require 'active_admin/mongoid'
require 'generators/active_admin/install/install_generator.rb'

ActiveAdmin::Generators::InstallGenerator.class_eval do

  # Make this a no-op so the AR migrations are not installed when ActiveAdmin-Mongoid is used.
  def create_migrations;end
end

It does stop the migrations from being installed, however, this pulls ActiveRecord in, so the specs fail. I'll dig a bit more, but if anyone has any ideas on how to get around that please let me know. @grzegorz-jakubiak @jdguzman

It has to do with this: https://github.com/activeadmin/activeadmin/blob/master/lib/generators/active_admin/install/install_generator.rb#L5
which must only be loaded when the rails g stuff is run.

@grzegorz-jakubiak
Copy link
Collaborator

I tried just replacing the whole install_generator.rb but I got:

Error: superclass mismatch for class Install Generator

I couldn't figure out the way not to require 'rails/generators' along with activerecord.
Maybe @deivid-rodriguez you have any ideas?

BTW @boie0025 https://github.com/activeadmin/activeadmin-mongoid/blob/master/lib/active_admin/mongoid/generators/install.rb it's already there but not required.

@Navdevl
Copy link
Contributor

Navdevl commented Jun 16, 2021

@grzegorz-jakubiak I am looking into this issue. I'd love to try this out. Hope that is fine if I share some insight on the findings I do or maybe come up with a solution.

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