Let’s see how to debug this app, before any sudden bug appears. Then run the migration : $> bin/rails db:migrateĪnd launch your local web server $> bin/rails server Then open config/routes.rb # inside config/routes.rb For now, we just noticed Rails creates all the skeleton for us. Scaffold view, rails, and modelsįor quick testing (as well as creating admin interfaces), Rails provides scaffolding : full creation of CRUD operation on a resource, $/myapp> bin/rails generate scaffold Computer name:string price:integerĬreate db/migrate/20211222182724_create_computers.rbĬreate app/controllers/computers_controller.rbĬreate app/views/computers/Ĭreate app/views/computers/_Ĭreate app/views/computers/_Ĭreate test/controllers/computers_controller_test.rb See the 3 last lines ? ** the debug gem is available in any Rails application by default **, even for minimalistic apps, which means Rails maintainers consider that this debug gem is something you can’t live without. Install minimal web application $> mkdir myapp & cd myapp Ruby 3.0.0p0 // you need at least version 3 hereĪny upper versions should work. Check you also have bundler installed, and npm above version 7 $> ruby -v PrerequisitesĬheck that you have ruby 3 already installed. From Rails 7, byebug has been replaced by ruby/debug, a feature that is available in Ruby 3.1, and available as a gem in every new Rails project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |