Guide used: link
Open terminal to run run.sh
rails new react_on_rails --webpack=react --database=postgresql
cd react_on_rails
rails db:create
public class Task {
String description;
boolean is_done;
DateTime due_date;
}
rails g model Task description:string is_done:boolean due_date:datetime
rails db:migrate
Use rails c
to open console:
- Add dummy data
task = Task.new( description: "CVWO Assignment", is_done: false, due_date: "2022-01-25 23:59" )
task.save
task = Task.new( description: "Dummy Assignment", is_done: true, due_date: "23:59" )
task.save
- If encounter
uninitialized constant Task (NameError)
, inputreload!
- To exit:
quit
Add gem 'fast_jsonapi'
to Gemfile
bundle install
rails g serializer Task description is_done due_date
task = Task.first
TaskSerializer.new(task).serialized_json
TaskSerializer.new(task).as_json
rails g controller pages index
yarn add react-router-dom
yarn add axios
yarn add react-modal
yarn add @mui/material @emotion/react @emotion/styled
yarn add @mui/icons-material
yarn add date-fns @date-io/date-fns
yarn add @mui/lab
rails g migration AddNoteAndIsPinnedToTasks note:string is_pinned:boolean
rails db:migrate
task = Task.new( description: "Dummy Assignment", is_done: true, due_date: "23:59", note: "dummy info", is_pinned: true )