Rails Basic Commands¶
rails new SimpleQuotes= Create a new rails application called "SimpleQuotes"rails generate scaffold <Model> <attribute>:<data type>= Create the Quote model and scaffolding using the rails generatorrails generate controller Home index= create a home controller with an index actionrails newrails generate(orrails g)rails serverorrails srails server -pe.g.,rails server -p 3030rails routesrails db:migraterails consoleorrails crails —helpcheck all the rails commands available for you
PATS dataset¶
git clone []- clone the repobundle install- install all the gemsrake db:populate- set up the database- remove any old databases, create new development and test databases, run all the migrations to set up the structure, and then create 240 owners with over 450 pets and several thousand visits (run the
create_allmethod in the context)
- remove any old databases, create new development and test databases, run all the migrations to set up the structure, and then create 240 owners with over 450 pets and several thousand visits (run the
rails test- verify model and controller tests are functioning- The
SimpleCovgem will create a coverage directory with an index.html file in it; open this file in a web browser to see the coverage provided.
- The
To load the testing context into development database:
1. if you have previously populated the database, drop it and rerun rails db:migrate to recreate a blank db.
2. open rails console
3. type require 'factory_bot_rails' (it will say 'false')
4. type require './test/contexts' (it will say 'true')
5. type include Contexts (it will say 'Object')
6. type in whatever context building method you wish (e.g., create_animals)