little-school-house.md - sample of training off of youtube#
The original video is here youtube: CRUD with active admin
create the app#
rails new little-school-house -T --database sqlite3
git add .
commit -m "Initial rails project"
Model#
rails g model Student name:string student_number:string
rails g model School name:string
rails db:migrate # make 2 tables
git add .
git commit -am "added 2 models"
Gemfile#
gem 'devise' # authentication gem, used by activeadmin
get the correct / complete line from the web site#
gem 'activeadmin' # https://activeadmin.info # pulls off rubygems.org
gem 'activeadmin', github: 'activeadmin' # pulls off github
rails g active_admin:install # configures defaults rails db:migrate
rails g active_admin:resource Student
rails g active_admin:resource Schoolcreate app/admin/?? files for these 2 rails db:seed # runs things activeadmin created in above step
config/environment/development.rb#
- Add config.reload_classes_only_on_change = false
- Change the config.file_watcher setting to equal ActiveSupport::FileUpdateChecker
this allows rails s to run all the time without restarts
Migrations db/migrate/#
rails g migration AddSchoolRefToStudents school:references