How to run migrations from a gem - ruby-on-rails

I have a gem installed in my rails app, and it has some migrations in
/db/migrate
how can I run them?
I've tried running
bundle exec rails g gem-name:install
but I get an error saying could not find generator gem-name:install.
I've run up against this problem with 3 different Gems this morning. What am I missing?

Old question, so sorry for the bump, but you were actually pretty dang close.
the correct command would be rails gem_name:install:migrations

Related

Ruby on Rails Trouble - rake-12.3.1

Anytime I try running the following basic rails commands, e.g. rails g model or rails console, I encounter the following error;
Could not find rake-12.3.1 in any of the sources
Run bundle install to install missing gems.
I've already looked through the forums for solutions and haven't found anything that solves my problem.
My gem file includes the necessary gem and I already ran bundle install.
Thanks in advance for your help.
This is because you have two versions of rake instaled.
Sometimes you have two rails projects with different rake versions and you did bundle install in one and after in another. (now you have two rake versions)
try gem uninstall rake
This command above will show you two these rake versions. You have to type the number that you want to unistall.

Ruby on Rails db migrate error while loading the hoe gems

I have been having this problem the whole day. whenever i try to do a rake db:migrate command on rails i keep getting this error.
"error while loading the hoe gem.
Please install it by running the following:
$ [sudo] gem install hoe".
But everytime i run and update all my gems i still get the same error.
The hoe gems i have already installed is the latest version (hoe 3.15.3)
Please help.
Am running rails 5.0.0.1this is the error i keep getting
Do you have the correct version? check your Gemfile.
Use bundle install to install correct version
I kind of found a way around it. I just deleted the previous app folder, created a new one and the problem was fixed. Good thing i was just starting out.

dynamic_form gem causes console not to load. Rails 4

I installed 'dynamic_form' gem in my rails 4.1.4 app. When I tried to run console (bundle exec rails console) I get the error below:
$ bundle exec rails console
Could not find dynamic_form-1.1.4 in any of the sources
Run `bundle install` to install missing gems.
But when I run server (bundle exec rails server) seems to work just fine.
Anyone else encountered this issue? thanks!
If you're talking about this gem, it looks to be significantly outdated. I doubt it has official Rails 4 support. Someone actually submitted an issue asking if Rails 4 support will be added.
Consider using another form gem - there are plenty.

Rake 10.0.4 not found in sources

I've just pushed a new Rails app from my local development machine to a server I have that has a few Rails apps already on, bundle installs everything correctly and rake tasks run fine, however when I try and start the app it fails with that message.
I've:
Trashed my Gemfile.lock and reran bundle install
Done gem install rake to get the latest version
Checked rake --version shows 10.0.4.
Checked bundle show rake shows 10.0.4
Restarted the server
Now I'm drawing a blank on what it could be. Using Phusion Passenger, rails 3.2.13, ruby 1.9.2p290. I use rvm for managing the environment, but I've not changed anything with it for a long, long while now. The other Rails apps are all working okay without any issues, with similar gem dependencies.
Self fixed, but not sure why. I ran bundle install rake by accident, forgetting it doesn't do what I think and it created a ./rake folder which solved the issue.
Perhaps your application is being run as the wrong user.

undefined method `action_mailer' during Capistrano deployment

I'm having this error message come up during Capistrano deployment. It implies to me that something's wrong with Rails being installed or something? Rails is not currently installed on the server side, but it's in my Gemfile (and my Gemfile.lock), so I'm assuming it should be installed during the bundle install command that gets executed before this line.
The actual command that's giving the error is:
bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile
I guess the problem is just that Rails is not being installed during the bundle install. Am I missing something?
Thanks!
UPDATE 1: Rails appears to be installing correctly via the bundle install command. If I check out the directory .../shared/bundle/ruby/1.9.1/gems, I can see action mailer in there.
UPDATE 2: Running the command rake assets:precompile actually fails locally as well, so this doesn't have anything to do with Capistrano it would appear. Now I just have to figure out why the config object doesn't know anything about action mailer?
UPDATE 3: Hot on the trail. It looks like my installed version of actionmailer is 0.6.1 (?!), meanwhile all the rest of my Rails stuff is up at 3.2.9. bundle update refuses to update actionmailer past this version. I'm going to remove all of my gems and start fresh.
UPDATE 4: Deleted my entire gemset using rvm gemset empty. Then tried to run bundle again, and again it tries to get actionmailer 0.6.1. I think something is screwed up with bundler or something...
The problem ended up being that I had removed a dependency upon a specific version of Rails in my Gemfile. I just had gem "rails" in there. That seemed to completely botch the dependency calculations, because it was getting super-old versions of action mailer rather than getting a consistent version from all gems. Guess it's a bad idea to not specify an exact Rails version. Yikes!
#aardvarkk,
Thanks for posting this issue, I was having the same error with my installation of Rails 4.0.0 and the error was preventing me from running my rails server
This is while I'm trying to follow the Hartl Tutorial for RoR.
I added gem "rails", '4.0.0' to my gem file and now I'm able to run my rails server.
Thank you

Resources