I have tried multiple ways to convert my existing rails app's database from sqlite3 to postgresql. i tried converting my database.yml file's adapter to postgresql and running rake db:create and migrate but that did not work i tried adding gem 'pg' instead of sqlite3 but still does not work. I am not able to push my projects to heroku i always get an "application error" when i run my heroku web site.
Make sure that you have removed sqlite3 from your Gemfile, and run bundle.
You may need to do a heroku migration.
heroku run rake db:migrate
Related
I'm following this tutorial on creating Ruby on Rail apps, and I've hit a roadblock. I am trying to migrate its database to Heroku, only to be told this:
c:\Sites\railsbridge\test_app>heroku run rails db:migrate
Running rails db:migrate on floating-ocean-40882... up, run.5709 (Free)
rails aborted!
Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not
loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the
minimum required by ActiveRecord).
I already have sqlite3 listed in my Gemfile, what am I doing wrong?
Heroku does not support sqlite and it is suggested to use postgresql for production
Please look into the following posts
Heroku deployment failed because of sqlite3 gem error
Deploying RoR app to Heroku with Sqlite3 fails
You can use Postgresql for production and the change should be simple. Just a change of gem in Gemfile and change in database.yml will do.
Heroku doesn't support SQLite it only support PostgresSQL here is full documentation for deployment on Heroku
I was trying to reset the seed data in my heroku database for an app i'm building and the developer site from heroku says to use heroku pg:reset DATABASE to do so.
After doing this and migrating my database again heroku run rake db:migrate followed by re-seeding with heroku run rake db:seed I cannot migrate any apps. even new ones. I don't know if a schema will help. It was not a database problem I was trying to fix, just a removal of repeated records.
I recently migrated a rails 3 app from a Mac OS X environment to a Debian server. The migration succeeded, the app is running through the WEBrick server but the formatting that had originally come with the activeadmin gem has disappeared from most views. The form is still accessible and functioning but it is in the default html formatting.
However http://domainexample.com:3000/admin still has the custom formatting, any ideas of why this has happened?
In my troubleshooting:
reinstalled activeadmin with
rails generate active_admin:install
When I run
rake db:migrate
got devise errors so dropped the databases and ran
rake db:create
rails s still works and boots the server but
rake db:migrate throws an error:
Mysql2::Error: Table 'admin_users' already exists
UPDATE:
This fixed the problem, but I don't understand why.
had to copy the active_admin.css as active_admin.css.dup.css file from my local and upload it to the server version in app/assets/stylesheets. The server version was implementing namespaces for some reason.
So I am somewhat new to Rails 3, and I am trying to integrate Google Maps with my Rails application.
I installed ym4r_gm from git://github.com/rorcraft.ym4r_gm.git, and I followed the tutorial on http://blog.brijeshshah.com/google-maps-in-ruby-on-rails/, and http://blog.brijeshshah.com/google-maps-in-rails-3/ .
After following the tutorial, I tried to run my application but I get an error that says "uninitialized constant ActionView::CompiledTemplates::GMap" regarding the "<%= raw Gmap.header %>" line. I have already installed the ym4r_gm-0.2.0 gem, and the ym4r-0.6.1 gem. Any suggestions on how to solve this problem?
Make sure that the gems you're trying to use in your Rails app are actually included in your Gemfile as well as being installed on your local machine.
Check out Ruby Gems for the exact line to include in your Gemfile. In this case, it's:
gem "ym4r_gm", "~> 0.2.0"
When you push your code to a production server like Heroku, the Gemfile tells Heroku which gems to pull down and install on the server. Also run this command when you're done.
bundle install
I'm sure this is astonishingly straightforward, and I'm just inexperienced with Rails 3, but I can't figure out how to make it work.
I'm trying to install the paper_trail plugin into my Rails 3 app; but the instructions seem designed for Rails 2. I'm running under Windows, and don't have git available.
I've tried putting gem 'paper_trail' into my Gemfile and running bundle install, which picked up the gem correctly; but rails generate paper_trail (which I assume is the new form of script/generate paper_trail fails with Could not find generator paper_trail.
Can anyone give me some step-by-step instructions to get this working?
A little late to the party. I am writing this since I found the thread through Google. Here is how I got it to work with Rail 3.0.9. I was getting the same error with
bundle exec rails generate paper_trail
as well as
bundle exec rails g paper_trail
and
rails generate paper_trail
Turns out, you need to run
bundle exec rails generate paper_trail:install
that generated the migration file for me and a
bundle exec rake db:migrate
created the table.
As of 11 October, rails generate paper_trail works as you would expect.
I've managed to make this work by simply downloading the zipped code from github, unpacking it into vendor/plugins, installing the gem (through Gemfile and bundle install), and then copy-pasting the migration code in paper_trail's generator into a blank migration of the same name.