Rails g migration doesn't work

前端 未结 3 2094
挽巷
挽巷 2020-12-20 03:21

When I run the command

rails g migration migration_name

I will get the \"error\" message:

Usage:
  rails new APP         


        
相关标签:
3条回答
  • 2020-12-20 03:51

    You are not running it inside a rails generated project directory. You are running it outside it.

    EDIT: It could also be if the script folder is missing. Or the rails script is missing inside the script folder if you are executing it inside the project folder.

    0 讨论(0)
  • 2020-12-20 04:02

    I've got the same, and i fixed by doing :

    cd /root/path/to/your/project
    
    bundle install
    
    bundle update
    

    Voilà :)

    0 讨论(0)
  • 2020-12-20 04:14

    Try adding a folder called script to your rails root.

    in this folder add a file called rails and add to it

    APP_PATH = File.expand_path('../../config/application', FILE)

    require File.expand_path('../../config/boot', FILE)

    require 'rails/commands'

    and execute again

    rails g migration migration_name

    0 讨论(0)
提交回复
热议问题