I am getting started with Ruby and working on simple app to get the basics.
I create the app with --skip-active-record flag. Now I need a model and neither rails g model Articles title:string text:string or rails g scaffold Articles title:string text:string
doesn't generate the model (note: scaffold command creates everything except model).
Environment:
Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.2'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'ruby_cowsay'
gem 'jbuilder'
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
gem 'activerecord', '~> 6.0', '>= 6.0.3.2'
Do you have a thoughts on where is the issue?
what I understand as you have used --skip-active-record
by this you are informing the application that you are not going to use models. For that reason it is actually skipping the model folder. I am not sure about your 100% sure about your motive here. but if you want to enable it in that case you can do the following.
1. Add database related gem in Gemfile ex: gem 'mysql2'
2. In config/application.rb uncomment the line require "active_record/railtie"
3. Add database.yml
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.