heroku_external_db icon indicating copy to clipboard operation
heroku_external_db copied to clipboard

Could not find generator heroku_external_db:generator

Open dlupu opened this issue 14 years ago • 7 comments

Hello Nat,

I would like to use your gem for my application. I've successfully installed it using bundle but when I run the generator I get the following error:

Could not find generator heroku_external_db:generator.

Rails 3.0.7, Ruby 1.9.1, heroku_external_db 1.0.1.

Any ideas? Or could you provide a sample of the file that the generator is supposed to generate so that i can adapt it to my needs?

Thanks! Dorian

dlupu avatar Aug 02 '11 22:08 dlupu

I also see this issue. I have basically the same environment except I'm using Rails 3.0.9 on Ruby 1.9.2

rtlong avatar Aug 03 '11 01:08 rtlong

@dlupu, I was able to work around this, though, by copying the lib/generators/heroku_external_db/templates/initializer.rb file into my app's config/initializers/ as heroku_external_db.rb. The rest of the code seems to work fine, so far.

rtlong avatar Aug 03 '11 05:08 rtlong

@rtlong thanks for the workaround. I will test this asap.

dlupu avatar Aug 03 '11 06:08 dlupu

Thanks guys! I've had no end of trouble getting the generator to appear in various versions of Rails. You'd think this would be simple but every time it seems like some version of Rails or other doesn't see it.

I'm thinking the simplest thing may be to just remove the generator and the instructions to use it, and replace it with an initializer to copy/paste out of the README. What do you think?

nbudin avatar Aug 03 '11 12:08 nbudin

I think it would be best to make the default initializer's behavior the default after having loaded the gem. That is, ditch the generic initializer. If ENV['EXTERNAL_DATABASE_URL'].present? then load the setup_rails_env! method. I don't know how one would go about this, but tell rails to load that method only if it hadn't been called already. That way, one could add an initializer (manually or by copy/paste) to implement the setup_configuration! method you outlined in the default initializer.

P.S. I have been awake for too long, so if that didn't make sense, let me know...

rtlong avatar Aug 03 '11 13:08 rtlong

I really don't want to do it that way. Personally I feel like I've wasted a lot of time having to work around gems that attempted to initialize themselves on loading. This gem, in particular, has the potential to pollute ActiveRecord configurations when being initialized.

Users having to put an initializer into their Rails configuration seems like a small price to pay for playing nice with other libraries.

nbudin avatar Aug 03 '11 13:08 nbudin

That is a good point. I'll change my answer, then: "What he said." :-)

rtlong avatar Aug 03 '11 16:08 rtlong