Making a new Rails App
Making a new app
Ruby on Rails is a fantastic back-end framework. As mentioned in my last blog I started learning it last year, and one of the main resource that helped me was the greatly written rails tutorial. But I still faced some issues while setting up a new app, so this is just a reminder for future me and maybe also to someone new to rails. I will also discuss containing gems locally.
To create a new Ruby on Rails app and run it
- First of all run
rails new name-of-the-app
- To change active directory simply write
cd name-of-the-app
- Install all required gems
bundle install
- Run server with
bin/rails server
orbin/rails s
Now if you want to use webpacker instead of sprockets, what should you do?
Well, try using --webpack
flag with rails new
as mentioned in webpacker documentation.
And if you are like me and it did not work for you, just simply change your Gemfile
to add it manually or simply write gem add webpacker
. After that bin/rails webpacker:install
will install webpacker.
You can also set bundle install
to some local directory with bundle config path 'path/to/dir' --local
to save space or handle gems without worrying about global gem versions.
Let me know what you think of this article in the comment section below!