Step 1 creating initial backend data - Thewessen/tic-tac-toe_ruby_backend GitHub Wiki
Oops! still working an the master branch... Let's create a new one.
Reading the docs, all examples go over creating a view associated with a controller. Because I wanted Emberjs controlling the view, I want Ruby on Rails to only function as a REST api. Some adjustments had to be made.
Testing the REST api functionality with a promised based request module in nodejs called Axios, I stumbeld upon a nasty error. I didn't realized (and I should have) that RoR uses a csrf token to protect against request forgeries. It took a while to figure that out, and realize why it wasn't working. Because I feel the pressure of finishing this app, I disable it by overwriting the 'protect_from_forgery' method on the ApplicationController class. That works, for now!
SO AWESOME! When ommiting the 'view' part of Ruby on Rails. You can remove the nasty '@'-sign in front of a variable. The '@' sign means global scope :D Feels like I'm writing Python again.
- Some error messages running
rails
. - Needed to run
bundle install
first. - When running
rails --help
: no 'config/webpacked.yml'. - Running
rails webpacker:install
: 'yarn is not install' - Yarn is not in the apt repository, so adding yarn and installing:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
- Running
rails webpacker:install
again: done!
- I like the csrf protection in place. The app should, eventually, not be cross domain.
- Setup redirection error handling in controllers.
- JSON specific request validation in models.
- Major cleanup of unused assets/views/stylesheets etc.