May 8, 2014
Unobtrusive Javascript in Rails
A common task in web applications is to grab some data from the server and then update the current page accordingly, without wanting a full page reload. Unobtrusive Javascript (ujs) is a pattern for accomplishing this with ease.
In this class, we'll start making our views come to life by adding javascript to make them more dynamic.
We'll continue with the activity tracker application we started last week, but instead of going to new pages when we submit forms, we're going to make it into a single-page application that feels more fluid and natural.
Pre-Requisites:
- ruby 2.1.1 (can probably get away with 1.9.3)
- rails 4.1
fork https://github.com/rails-school/simple_tracker and clone your fork (can get away with just cloning https://github.com/rails-school/simple_tracker but then you won't be able to push back your changes)
bash% git clone [email protected]:<your_username>/simple_tracker.git
switch to the branch we ended up with last time (activities_with_category)
bash% git checkout -b activities_with_category bash% git pull origin activities_with_category
install dependencies
bash% bundle install
launch a rails server
bash% rails s
make sure the site is running at http://localhost:3000
2:30pm Pacific - 4:30pm Pacific on May 8, 2014
at
Coshx Labs
4 students were there