RoR Capistano deploy:migrate uninitialized constant - ruby-on-rails

I'm running Ubuntu on EC2 and using Capistrano to deploy my app.
Capistrano won't let me run "rake db:schema:load" so I used rails to create a new migration called CreateTables. Then I copied in the create_tables from the schema.rb and ran "cap deploy:migrate".
But, I get this error: uninitialized constant CreateTables
Any ideas?
Thanks

For some reason, when I tried $ cap deploy:cold, I was able to get the tables created via a migration.

Related

Uploading Ruby on Rails project from github to AWS EC2 instance error

I have a project my group has created in ruby on rails, I am responsible to uploading it to the AWS EC2 instance from github. I can get this application to work locally but when its on the instance I get an error with sql. We created a new project in the command line and did most work there so we did not personally create a database. I am new to ruby on rails and AWS so I am lost... Thanks in advance! I have attached photos of it working locally and it not working on the instance.nonworking on ubuntu server here it is working locally
Not sure what went wrong, but it looks like you sqlite3 is not connecting to the migration. From your ec2 instance (& in the root directory of your app), you can try to drop the db and migrate =>
bundle install
And then
rake db:drop && rake db:create && rake db:migrate
or
rake db:reset
You could also look up this tutorial: DEPLOYING RAILS APP TO EC2 INSTANCE VIA GITHUB

Heroku deployment error RoR

When running my RoR app in Heroku shows this error:
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
Checking the heroku logs, this shows http://pastebin.com/yTWtRMVD
My main page is https://salty-stream-26420.herokuapp.com/ and my callback URL is https://salty-stream-26420.herokuapp.com/auth/twitter/callback in OmniAuth.
It runs in Cloud9 perfectly but not in Heroku. What is wrong?
Thank you, Alex.
This:
2016-05-03T13:47:23.544506+00:00 app[web.1]: PG::UndefinedTable: ERROR: relation "submissions" does not exist
suggests to me that you have to simply migrate your database on the remote server.
Try running heroku run rake db:migrate
You will have to create environment variables in the config/database.yml file for the username, password and database name
Those same environment variables need to be defined under
Heroku login >> application >> settings >> reveal config vars
By default you will get a DATABSE_URL something as
postgres://wwwbirawxqwmws:7bef28c02299c9c6054a646b5ce19276bbab52feca6692dac8305b32dbd7d36c#ec2-81-XX-XXX-X26.compute-1.amazonaws.com:5432/d6n59y5r09ko99
where wwwbirawxqwmws is USER
and 7bef28c02299c9c6054a646b5ce19276bbab52feca6692dac8305b32dbd7d36c is PASSWORD
and d6n59y5r09ko99 is the DATABASE
These three variables needs to be assigned in the heroku config, then you will be able to run
heroku run rake db:create
heroku run rake db:migrate

Migration Errors on Heroku

I have a Rails app which I have recently pushed up to Heroku. When I try to migrate the database with:
heroku run rake db:migrate
I am getting the rake aborted! message and complains about a table that doesn't exist.
Locally, when I run the migrate command there are no issues so why is Heroku different?
I did experience this issue the last time I migrated on Heroku too - I ended up using:
heroku rake db:schema:load
to overcome the problem but I really want to get to the root of the problem so it stops happening.
Any suggestions?
EDIT: I know which migration file is at fault but is it safe to remove a file from the migrations folder?

Rails confused between dev and test environment

I'm just moving my rails app to a new development machine.
for the first time, I am running rails on ubuntu in a virtualbox on a windows 7 host OS.
When I run rake db:create, it creates the rails_app_test.
When I run rails s, I get the error
unknown database rails_app_dev
I am trying to use the development environment, but for some reason rake is creating test. Why is this, and how do i correct it?
Your environment variable seems to equal 'test'.
Try:
rake db:migrate RAILS_ENV=development

how to deploy "surveyor" Rails plugin on heroku.com?

I'm kinda new to this stuff, and I need some help please
I created my rails app using ruby 1.8.7/rails 2.3.8
I added Surveyor to the Gemfile.
I pushed the project to heroku.com using git, went through the normal
procedure in the "Quick Start" guide on heroku, including
$ heroku bundle install
$ heroku db:migrate
and all went through peacefully. But when I try to create a survey
using:
$ heroku rake surveyor FILE=surveys/kitchen_sink_survey.rb
I get the following error:
rake aborted!
uninitialized constant Surveyor
Can anyone help me with this please?
You will need to run rails generate surveyor:install before db:migrate
You need to also add the gem to your environment.rb
Rails::Initializer.run do |config|
config.gem "surveyor"
end

Resources