I ran a rails g migration rename_user_id_columns and it says:
invoke active_record
create db/migrate/20140617192830_rename_user_id_columns.rb
The problem is this file does not actually exist in the folder, and also I ran a search on my whole computer and couldn't find it. Interestingly, when I try to then create the file manually in Sublime and save, it tells me I'm going to be overwriting an existing file. Whenever I try to run the manual migration, I get the following error.
rake aborted!
NameError: uninitialized constant RenameUserIdColumns
A restart of the computer fixed this problem for me. But I think going to Project > Refresh Sublime could do the trick as well.
Related
I'm working on a hyrax project, after creating a work type with rails with the following command
$ bin/rails generate hyrax:work GenericWork
I try to delete the work type with the following commands
$ bin/rails destroy hyrax:work GenericWork
$ rake db:rollback
but I keep getting the error
Routing error:
Uninitialized constant GenericWork
after I delete it with the commands above.
Why is it ?
According to the documentation, after removing a work type (with rails destroy hyrax:work GenericWork) you have to remove the line that registers a work from config/initializers/hyrax.rb.
Have you tried that?
Also, can you please search your code for GenericWork? Routing error suggests it might be used in routes.rb file
After upgrading to Rails 5, I receive an error message like following every time I try to load from schema (set up a new computer on the app, run rails db:test:prepare before running tests, etc.):
ActiveRecord::StatementInvalid: PG::UndefinedObject: ERROR: type "serial" does not exist
LINE 1: SELECT 'serial'::regtype::oid
Searching around isn't yielding much help. The most relevant thread is this one: https://github.com/rails/rails/issues/30298 but I am not trying to run any new migrations, nor does the schema_plus_indexes gem seem to have anything to do with the issue (the two issues described in that thread).
In our case, we don't keep migration files around after they have been run against all databases. Because of this, when working on the upgrade to rails 5, there were 0 migration files present. The issue, it seems, is that rails will only automatically "fix" your schema.rb file for you if you are actually running a migration file (even trying rails db:migrate with no migration files present won't work).
The solution, for us, was to create a blank migration and run rails db:migrate in order to get the schema.rb file properly formatted.
I am using c9 IDE.
The command I entered in the terminal: bundle exec rails generate migration CreateContacts.
I get a message: error: could not find 'rails'.
This is the command in Nitrous, is there a different command in cloud9?
Is there a step-by-step procedure to manually create the rails migration CreateContacts in the File Directory in cloud9? What code is entered into the newly created files. I notice in the Rails Guide a a file is generated e.g. number (YYYYMMDDHHMMSS)_create_contacts.rb, if this file is manually created will this number e.g. (20160928130510)_create_contacts.rb - be correct and what code is entered into the file?
I'm pretty stuck here and need some expert guidance on this one please.
I use cloud9 IDE as well and when i want to create a migration file i simply do rails generate migration . (I dont include bundle exec in the command)
The file generated in the migration folder will be created in the YYYYMMDDHHMMSS format.
Everything was working fine yesterday and all of a sudden when i tried to run my server or run any rake tasks i get this error
Mysql2::Error: Table 'myapp_development.key_value_stores' doesn't exist: SHOW FULL FIELDS FROM `key_value_stores`
I've tried google searching and searching on stackoverflow all morning and cant find a solution to this
Try to rollback your migration file (take backup of the migration file will help while creating new ),
rake db:migrate:down VERSION=migrations's_version
and then try to restart the rails server.If you face same problem then with same migration number search in schema_migrations table in database delete that record and make new migration again.
I was struggling with this for a while but what i ended up doing
update xcode and update command line tools
uninstall then install mysql via homebrew
then i ended up manually removing my database folder in
usr/local/var/mysql/myapp
then i did a
rake:create
and then i just pulled my production database and copied it to my development database
rake db:backup_and_load
then I was up and running again
dont know which one of that fixed it specifically but thats what i did
Essentially I have a basic app that I would like to use as base for my other projects.
I ran git clone git#site.org:user/app.git newfolder
But when I run my rails app rails s I get the following error:
Migrations are pending; run 'rake db:migrate RAILS_ENV=development' to resolve this issue.
So I run rake db:migrate and start the app again, getting the following error:
I have a sneaking suspicion that it has something to do with the app name as asked in this question but I noticed the solution was provided for Rails 3 and the GitHub project hasn't been updated in two years.
Essentially, I think I have a solution (renaming the app) but I don't know how to do that. However, I may be wrong and I don't know why I am getting this error?
You are getting this error because, one of the css files you are requiring in your application.css is requiring application.css. Go through all the file in your app/assets/stylesheets and make sure that none of the file that is required in application.css is requiring application.css.