Rails error when I try generate a scaffold
You are getting the error because you have missed the model name in the generate command. Your scaffolding command should be
rails g scaffold <ModelName> title:string language:string engine:string little_description:string description:text on_production:boolean game_type:string platform:string dimension:string
If your model name is Product
, the scaffold should be like
rails g scaffold Product title:string language:string engine:string little_description:string description:text on_production:boolean game_type:string platform:string dimension:string
Rails generate scaffold error message
One of your gems doesn't match your installed Ruby version.
Open up your Terminal utility, cd /Users/macowner/workspace/toy_app
and run:
gem pristine --all
bundle install
This command will restore your gems to their original condition at the time you installed them.
Brand new rails app, can't generate scaffold
The error states that it can't find a version of sqlite3 ~> 1.3.6
so that is what your Gemfile should require:
gem 'sqlite3', '~> 1.3.6'
The more lenient definition of gem 'sqlite3', '~> 1.3', '>= 1.3.6'
which will also allow 1.4
is only valid for the master branch of rails.
Edit
The 5-2-stable branch actually now also allows using sqlite 1.4 but the currently released 5.2.2 gem does not.
Update 2019-03-18
Now that rails 5.2.2.1 has been released, the correct and also easiest fix is to bump rails to that version, as it will restrict sqlite3 to 1.3.6
:
# In Gemfile
gem 'rails', '~> 5.2.2.1'
Given the security fixes in that version, this should be done anyway.
rails generate scaffold error on _from.erb (jbuilder issue?)
Details above, but:
Well, I solved the problem on my own, and just wanted to report back.
So, I forgot I had had trouble installing Nokogiri as well. Whenever I
ran "bundle update" I was getting an error that said I needed to make
sure the latest version of Nokogiri was installed correctly before
continuing. I ignored this, because I couldn't figure out out. This
was solved by simply following the instructions at nokogiri.org and
installing the necessary libraries:sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
gem install nokogiri
After I did this I thought to myself "Uh, duh, this is probably the
solution to the scaffolding issue." Indeed it was.
Related Topics
Copy into Postgres with Arrays in Schema
Rails 4 - Pundit - Create Policy
Rally Ruby Toolkit: How to Get Url of Portfolio Item's State
Watir Won't Download PDF, Only Opens in Viewer
What Does the |Variable| Syntax Mean
Mail_Form Gem with Sidekiq Worker
Access Image from Different View in a View with Paperclip Gem Ruby on Rails
Knowing When Resque Worker Had Completed Job
When Joining Table, Rails Anyway Makes Additional Request When Accessing Fields from Joined Table
How to Count the Frequencies of the Letters in User Input
Ruby Net-Ssh Calling Bash Script with Interactive Prompts
How to Convert Timestamp with Ruby
Check Whether a Variable Is a String in Ruby
Should I Specify Exact Versions in My Gemfile
Local Server Error After Upgrading Ruby from 1.8.7 to 1.9.2 (With Rails 3.1.1)