Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rails Developer's Intro to Ember

Rails Developer's Intro to Ember

So you want to make a nice shiny Ember app as your Rails API's main frontend and are not sure where to start? Lets jump into building a new Ember app integrated with Rails using the ember-cli-rails gem.

This talk was given to Ancient City Ruby 2016.

Robert Jackson

April 08, 2016

Transcript

73 slides
  1. Who the heck is this guy? • Ember Core Team

    • General Open Source Addict • Twitch twitter: rwjblue github: rwjblue
  2. Rails Development bin/rails generate controller welcome index # add to

    config/routes.rb root 'welcome#index' # add to app/views/welcome/index.html.erb Welcome
  3. Rails Development % bin/rails test Finished in 0.194783s, 5.1339 runs/s,

    5.1339 assertions/s. 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
  4. JavaScript console.log(typeof null); // object console.log(NaN === NaN); // false

    console.log([] + []); // "" console.log({} + []); // 0 console.log(typeof NaN); // number let a = new Date(2016, 1, 1); let b = new Date(2016, 1, 1); console.log(a === b) // false https://www.destroyallsoftware.com/talks/wat
  5. Ember Development % ember test 1..8 # tests 8 #

    pass 8 # skip 0 # fail 0 # ok
  6. Rails Development bin/rails generate controller welcome index # add to

    config/routes.rb root 'welcome#index' # add to app/views/welcome/index.html.erb Welcome
  7. Silly Demo % gem install rails --pre % rails new

    acr16-rails-api --skip-turbolinks --api
  8. Silly Demo % bin/rails generate ember:init % npm install -g

    ember-cli % ember new frontend --skip-git % cd frontend % ember install ember-cli-rails-addon
  9. Silly Demo # edit app/controllers/application_controller.rb # # not needed after:

    # github.com/thoughtbot/ember-cli-rails/pull/400 class ApplicationController < ActionController::Base end
  10. Silly Demo % cd frontend % ember generate template application

    % echo "<h1>Hello, Ancient City Ruby!</h1>" > \ app/templates/application.hbs

More Decks by Robert Jackson

Other Decks in Programming