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

個人でつくるwebサービス

 個人でつくるwebサービス

銀座Rails#5 での登壇資料です。個人でwebサービスを作るときのtips集及びturbolinks&stimulusの紹介が主な内容です。

https://ginza-rails.connpass.com/event/112093/

Shinichi Maeshima

January 25, 2019
Tweet

More Decks by Shinichi Maeshima

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ 4 લౡਅҰ aka @willnet or @netwillnet 4 גࣜձࣾ΢Οϧωοτ(Ұਓձࣾ) 4

    Railsٕज़ސ໰ 4 ۭ͍ͨ࣌ؒͰ savanna.io Λ։ൃ͍ͯ͠·͢
  2. ίʔυ $(document).on('turbolinks:load', () => { // ͜͜ͰApp.chatͷ࠶࡞੒Λېࢭ͍ͯ͠Δͷ͕ݪҼ if ($('#messages_form').length >

    0 && !App.chat) { App.chat = App.cable.subscriptions.create( { channel: 'ChatChannel', room_code: roomCode }, ...
  3. turbolinks୯ମͰ࢖ͬͨͱ͖ͷ໰୊ ͕ղܾͰ͖Δ લॲཧɺޙॲཧ͕؆୯ʹॻ͚Δ // messages_controller.js export default class extends Controller

    { connect () { this.subscribe() } disconnect () { if (App.chat) { App.cable.subscriptions.remove(App.chat) App.chat = null } }