For Rails 3 and Rails 4:
Use
-O
(Capital ‘O’) or--skip-activerecord
option to generate an application without a database.
rails new myApp -O
or
rails new myApp --skip-activerecord
This Answer is reshared from here
For Rails 5:
Use
--skip-active-record
option to generate an application without a database
Notice the extra hyphen ‘-‘ as opposed to previous Rails versions.
rails new myApp --skip-active-record