sorcery icon indicating copy to clipboard operation
sorcery copied to clipboard

Sorcery Generator fail, when using Mongoid

Open Nerian opened this issue 15 years ago • 8 comments

  • Rails 3.1
  • Mongoid
➜  sparkle_share_web git:(master) ✗ rails generate sorcery:install
      create  config/initializers/sorcery.rb
    generate  model User --skip-migration
      invoke  mongoid
      create    app/models/user.rb
      invoke    rspec
      create      spec/models/user_spec.rb
      invoke      fabrication
      create        spec/fabricators/user_fabricator.rb
      insert  app/models/user.rb
/Users/Nerian/.rvm/gems/ruby-1.9.3-p0@sparkleshare-web/gems/sorcery-0.7.4/lib/generators/sorcery/install_generator.rb:56:in `next_migration_number': uninitialized constant Sorcery::Generators::InstallGenerator::ActiveRecord (NameError)
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@sparkleshare-web/gems/railties-3.1.1/lib/rails/generators/migration.rb:49:in `migration_template'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@sparkleshare-web/gems/sorcery-0.7.4/lib/generators/sorcery/install_generator.rb:51:in `copy_migration_files'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@global/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@global/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@global/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@global/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@global/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@global/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@global/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@global/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@sparkleshare-web/gems/railties-3.1.1/lib/rails/generators.rb:168:in `invoke'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@sparkleshare-web/gems/railties-3.1.1/lib/rails/commands/generate.rb:12:in `<top (required)>'
    from /Users/Nerian/.rvm/gems/ruby-1.9.3-p0@sparkleshare-web/gems/railties-3.1.1/lib/rails/commands.rb:28:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Nerian avatar Oct 30 '11 19:10 Nerian

I can confirm this issue. Maybe it's because of pull#93?

abhishiv avatar Nov 03 '11 00:11 abhishiv

FWIW, I haven't been able to reproduce this bug. I'm running OS X 10.7.2, and I've tried:

[Ruby 1.9.2, 1.9.3] + [sorcery head, sorcery gem 0.7.2, 0.7.4] + Rails 3.1.1 + mongoid 2.3.3 + mongodb 2.0.1

corockliff avatar Nov 03 '11 22:11 corockliff

Maybe we should just wrap the areas expecting ActiveRecord with "if defined?(::ActiveRecord)" so they won't run when ActiveRecord is not loaded.

NoamB avatar Nov 05 '11 18:11 NoamB

@corockliff:

Did you do this?:

Open myapp/config/application.rb and near the top, remove the line require 'rails/all' and add the following three lines so you end up with this:

require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"

@NoamB: That would probably be enough. Even if the task is fails, it is still configuring all that is needed.

Nerian avatar Nov 05 '11 18:11 Nerian

@Nerian:

To clarify: I wasn't experiencing the issue, just trying to reproduce the bug.

corockliff avatar Nov 05 '11 18:11 corockliff

I am having problems with rails generate model user..every time i run it i get the below error..

rails generate model user provider:string uid:string name:string email:string No value provided for required options '--orm'

my application.rb file looks like:

require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie"

these are the gems i am using...i was using a mongoid-generator but found out that's incompatible with rails 3.1. I am running ruby version 1.8.7

gem 'jquery-rails' gem 'rspec-rails', :group => [:development, :test] gem 'database_cleaner', :group => :test gem 'factory_girl_rails', :group => :test gem 'mongoid-rspec', :group => :test gem 'omniauth-twitter' gem 'omniauth-facebook' gem 'omniauth-github'

any thoughts?

pinara747 avatar Nov 11 '11 22:11 pinara747

Same problem here - rails g sorcery:install gives me "uninitialized constant Sorcery::Generators::InstallGenerator::ActiveRecord" since ActiveRecord is not active (I'm using mongoid).

saschagehlich avatar Nov 16 '11 13:11 saschagehlich

Same problem here! Latest rails 3.1.3

Having these lines in application.rb:

require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"

create-renegr avatar Dec 11 '11 19:12 create-renegr