 Okey, kita hanya menghidupkan beberapa keputusan. Jika anda berada di sini selama dua minggu lalu, anda akan tahu bahawa saya akan menghidupi anda untuk hari ini. Jadi kami akan mempunyai dua berita di antara 3 tahun dan 4.30. Okey, jadi apa adalah Lady Tech? Lady Tech adalah komuniti yang berlainan untuk perempuan, menghidupi, belajar dan mengadakan programnya. Okey, maaf. Lady Tech adalah komuniti yang berlainan untuk perempuan, belajar dan mengadakan programnya. Jadi kami tidak mempunyai sekolah atau syarikat atau NGO. Kami semua mempunyai kerana kami percaya dalam kursus kami. Jadi apa kursus kami? Pertama, kami percaya bahwa teknologi adalah superkuat. Dan dengan kisah ini, anda dapat membuat sesuatu yang berguna untuk diri dan orang lain. Okey, jadi teknologi adalah untuk semua orang, berdua lelaki dan wanita. Tidak-tidak, sebuah perempuan yang berlainan yang berlainan, itu sebabnya Lady Tech berlainan untuk berlainan lagi. Sebenarnya, kami tidak mempunyai sebuah perempuan. Jadi kami mempunyai bahawa perempuan adalah penting, dan mereka mempunyai sesuatu untuk berlainan. Jadi pada Lady Tech, kami mempunyai beberapa program yang berlainan untuk menyelamatkan semua orang yang berlainan dalam programnya, sehingga cara untuk berlainan. Pertama, Lady Tech adalah tempat di mana anda dapat menemui perempuan anda dan berlainan dengan sebuah perempuan yang berlainan dan berlainan. Perempuan yang di bawah ini adalah Lady Tech pergi. Kamu mahu menemui perempuan yang berlainan, tetapi tidak tahu apakah kamu tidak mahu pergi. Saya sedang membeli perempuan saya untuk menemui perempuan yang berlainan dengan Lady Tech pergi. Kita juga mempunyai Lady Tech. Ini adalah kejur untuk menarik diri kamu pada makan-akan dengan perempuan perempuan. Dan berbual tentang semua perkara atau tidak. Lady Tech mempunyai perempuan yang berlainan pada perempuan di setiap kejurannya. Nahそ Seriously We Wanna Teach Women How to Code. So Pillars Under the Spillers are Tech Jong Ladies Study where the Tech Ladies Study is a Self Reliant Study group for beginners. We meet at a café every week to learn and practice computer science with one or two mentors joining us to answer any technical questions you have. And we also have Tech Ladies Coding Week where we learn how to code over the week end. So this is a two days workshop where you get your hands dirty dan memdesaini aplikasi web yang sangat sukar. Jadi akhirnya, kita mahu membantu wanita masuk ke industri. Jadi program yang di bawah ini adalah Tech Ladies' Tech Talk di mana ia adalah sebuah pelajar teknik untuk wanita dari semua kelebihan teknik. Jadi dalam ini, anda akan belajar tentang topik teknik dari wanita yang mencari kelebihan dan Buk Kemp yang akan saya berkongsi lebih banyak kelebihan nanti. Jadi jika anda mahu tahu lebih banyak tentang program kami, Just go on our website techladies.co. Okey, sekarang lebih banyak tentang Buk Kemp dari Tech Ladies. Buk Kemp dari Tech Ladies adalah program 12-week part-time yang dipanggil untuk membantu wanita dengan sebuah kelebihan nanti untuk mengubah kelebihan kelebihan ke industri tech. Jadi wanita dari semua kelebihan nanti akan datang bersama. Buk Kemp ini adalah pengalaman kelebihan kelebihan di mana anda bekerja dalam sebuah pelajar nanti, dibuat oleh sebuah pelajar kelebihan untuk bekerja dalam sebuah projek dan NGO. Sejauh ini, komuniti di belakang Tech Ladies telah membuat kelebihan nanti untuk pekerjaan yang berhasil dalam sebuah pelajar nanti untuk mengubah kelebihan kelebihan nanti. Dan kami sedang memulakan kelebihan kelebihan kelebihan nanti. Okey, jadi anda dapat membaca lebih banyak detail tentang kelebihan nanti di atas www.techladies.co. Buk Kemp 3. Jadi kelebihan nanti adalah program 12-week part-time yang akan dihidupkan dalam langgan program rubi. Langgan yang sama yang anda akan belajar hari ini. Okey, jadi ada 5 pelajar yang membahas kelebihan untuk bekerja dalam dua projek. Setiap pelajar akan bekerja dalam satu projek sehingga kelebihan nanti. Okey, jadi anda akan diberikan kelebihan untuk belajar daripada pelajar kami dan pelajar kami akan mendengar untuk membahas anda. Sejujurnya, anda akan berharap bekerja dalam projek dengan pelajar kami mencari kelebihan nanti dan menjawab pertanyaan anda. Jadi ini akan berlaku online atau dalam persen. Sejujurnya akan berjumpa dalam persen untuk belajar kelebihan nanti dan mengubah kelebihan nanti. Mereka akan berjumpa setiap hari antara 29 Juli dan 14 Oktober selain selama dua minggu, 19 August dan 16 September. Jadi anda akan berharap berjumpa sekurang-kurangnya 15 jam setiap minggu kelebihan. Okey, untuk menggunakan kelebihan untuk kelebihan, aplikasi perlu membuat kelebihan teknikal. Jadi anda dapat mencari lebih banyak detik tentang kelebihan di sini juga. Ia di github.com.com.au. Jadi kami juga akan menerimanya kelebihan ini hari ini. Tengah kelebihan mungkin nampak menarik, tetapi ia sebenarnya sangat jelas. Jadi jangan risau. Kita di sini untuk membantu anda mencari kelebihan untuk menyelamatkan kelebihan ini. Jadi kami telah mencari kelebihan ini untuk memberi kelebihan yang anda perlukan untuk menyelamatkan kelebihan teknikal. Anda dapat mencari semua kelebihan, kelebihan dan kelebihan kelebihan di sini. Okey, jadi dengan kelebihan ini, anda akan belajar bagaimana untuk mencari dan membuat aplikasi yang mudah dan membuat kelebihan untuk menyelamatkan kelebihan teknikal. Okey, membuat kelebihan teknikal dan membuat aplikasi untuk kelebihan ini pada bulan 3 Juli. Jadi 2, 3, 5, 9 sebelum setiap malam, dan anda dapat mencari aplikasi dari link-link di bawah. Link yang sama. Okey, jadi anda mungkin mempunyai beberapa masalah dengan kelebihan teknikal tetapi jangan risau. Jika anda perlukan kelebihan untuk menyelamatkan kelebihan ini, anda boleh menikmati kami di klinik kode ini untuk mempunyai jawapan pertanyaan anda. Kita mempunyai sebuah pelajar di sini untuk membantu anda. Jadi tolong beritahu bahawa ini bukan kelebihan, ia adalah sebuah klinik Q&A jadi ingat untuk membawa klinik kode untuk membantu anda. Ada dua pelajar kelebihan kode anda boleh mencari berdua jika anda mahu, tetapi tidak perlu buat begitu. Okey, sebelum kita bergerak kelebihan teknikal jika kita mempunyai beberapa pelajar untuk membantu anda di kelebihan teknikal. Apabila anda mempunyai konsep yang anda tidak faham atau mempunyai masalah, jika anda mempunyai kelebihan untuk membantu anda. Sekarang, kami akan mempunyai pelajar kelebihan untuk membantu mereka. Jadi, pelajar, beritahu kami nama anda, karar dan mungkin sebuah pelajar kelebihan untuk membantu anda. Kita akan bercakap sebelum ini dan ini saya berminat di Red Hat. Okey, terima kasih. Saya rasa kita mempunyai beberapa pelajar yang berada di luar, jadi apabila mereka datang, kita akan bercakap sekarang. Mungkin kita boleh tanggalkan mikrofon untuk pelajar kelebihan supaya anda dapat membuat pelajar kelebihan. Baiklah, saya hanya akan setelah menghidupkan kelebihan saya di sini dan kita akan mulakan. Baiklah, terima kasih untuk datang ke sini pada hari seteridak untuk menerima pelajar. Nama saya Ted dan saya akan pelajar kelebihan untuk hari ini membantu pelajar kelebihan. Saya telah menjadi pelajar kelebihan untuk melupakan sekitar 10 tahun sekarang. Saya telah pergi Singapura selama 3 tahun untuk melakukan kerja di lokarestan se privat tersebut, yang ialah Tinkerbox. Saya juga se strah, trafican bootcamp 1 dan bootcamp 2. Saya tidak akan menjadi trafican tuan ini, tetapi terhadap coba-cока saya, saya pasti anda akan setuju kekejapan saya. Saya juga terdapat kememunan untuk sebenarnya bekerja di sekeliling dengan beberapa pelajar kerana dari pelajar kelebihan yang terbegin ...untuk menjadi pembangunan software. Jadi, saya hanya ingin memasukkan skedul yang Johan telah menunjukkan. Kita akan segera mencari ini. Jadi, perubahan bergantung di mana kita berada di perubahan app. Saya telah mencari sejauh-jauh-jauh-jauh... ...untuk menghubungi teori dengan koding. Tetapi, tetapi, tetapi, tetapi, tetapi, tetapi, tetapi... ...untuk menghubungi teori dengan teori dan lebih banyak koding pada akhirnya. Kita akan membuat aplikasi yang kecil hari ini... ...dengan menggunakan Ruby on Rails. Ia akan kecil dalam termasuk perubahan. Kerana salah satu alasan yang paling berkembangan kita dapat... ...dengan perubahan ini adalah bahwa kita bergerak sedikit terlalu cepat. Jadi, saya akan mencari... ...berhubungi perubahan yang kita membuat... ...dan memastikan bahawa belajarannya berkembangan. Kita akan membuat aplikasi yang terlalu cepat... ...dengan aplikasi yang kecil hari ini. Dan saya rasa itu perkara yang paling penting. Perubahan adalah banyak aplikasi yang terlalu cepat. Dan ia pasti akan menjadi aplikasi yang terlalu cepat... ...di mana kita tahu sekurang-kurangnya. Kita akan dapat menghubungi aplikasi yang terlalu cepat... ...dan berkembangan di aplikasi. Tapi saya perlu beritahu anda bahawa ia tidak akan terlihat sangat baik. Ada beberapa kelimitasan kepada apa yang kita dapat mencapai dalam tiga jam. Dan sebab kita mahu fokus pada aplikasi... ...saya tidak mahu melakukan apa-apa yang berkaitan dengan CSS atau javascript... ...yang bermakna aplikasi akan membuat perubahan... ...tapi ia akan bekerja yang paling penting. Jadi, sebagainya, mari kita melakukan perubahan yang cepat. Dan siapa di sini adalah pada perubahan pertama... ...yang adalah perubahan CSS dan HTML. Semua orang yang berada di perubahan kedua... ...yang adalah perubahan Ruby. Biar saya tahu bagaimana saya harus fokus lebih banyak... ...semasa kita berjalan-jalan. Jadi, ini adalah listan perubahan yang kita akan membuat... ...dalam aplikasi yang terlalu cepat... ...dengan perubahan Ruby. Perubahan akan dapat melihat listan semua perubahan. Perubahan akan juga dapat melihat perubahan perubahan... ...dan mereka akan dapat melihat perubahan perubahan perubahan. Menurut bagaimana lama ia berlalu membuat perubahan ini... ...kita mungkin juga, jika kita mempunyai masa, membuat perubahan... ...yang berkata bahawa saya boleh menulis perubahan di aplikasi. Dan itu penting... ...sebab apabila kita membuat perubahan perubahan perubahan perubahan... ...saya akan melihat kembali dan menerima perubahan ini... ...untuk membuat perubahan sendiri. Kita akan mempunyai sekitar 15 menit... ...sebelum kita mulai kerja semula... ...menjaga semua orang mengambil set-up. Sebelum apa-apa, perubahan yang saya menunjukkan sekarang... ...saya menunjukkan bahawa sebuah ruang speaker... ...saya juga mempunyai online. Jadi, saya mempunyai untuk memilih tab separat. Jadi, dalam kes yang anda lupakan sesuatu atau anda ke belakang, anda tidak perlu risau, anda boleh mengikuti slides pada pukul anda sendiri. Dan sama sekali, jika anda sudah tahu sedikit dan anda ingin melihat ke depan, anda boleh juga menggunakan slides untuk itu. Jadi URL ini adalah tinyurl.com. Ini tidak boleh membuat anda mengedit slides dan jika ia berlaku, jangan mengedit slides. Saya akan beri anda 10 saat lagi supaya semua orang ada peluang untuk membuka slides. Selanjutnya, kami ingin pastikan semua orang mempunyai set-up cloud 9. Anda harus mempunyai sebuah account untuk cloud 9. Anda harus mempunyai set-up workspace yang adalah Ruby on Rails template. Dan saya rasa saya dapatnya di sini supaya saya dapat menunjukkan anda. Jika anda dapatnya betul-betul, ia patut melihat sesuatu seperti ini. Anda akan mempunyai apabila saya mempunyai app. Anda akan mempunyai file finder. Jika anda tidak mempunyai account cloud 9, atau jika anda tidak mempunyai set-up workspace Ruby on Rails, tolong mengambil tangan anda sekarang supaya peluang dapat membantu anda. Kami akan membutuhkan ini. Saya sudah melihat beberapa tangan. Kami akan membutuhkan pertolongan. Kami juga akan membutuhkan GitHub untuk membunuhkan kerja kami. Ini adalah pilihan. Kami masih boleh membutuhkan GitHub untuk membunuh kerja kami. Jika anda mahu membutuhkan app untuk GitHub, pastikan anda mempunyai account dan anda mempunyai GitHub. Anda juga perlu menghubungi account GitHub untuk cloud 9. Jadi, instruksi yang anda lakukan itu adalah pilihan GitHub. Tapi kami tidak mahu membunuh GitHub pada kerja ini. Kerana kerja ini adalah sebuah kerja, tetapi apabila kami perlu membunuh sesuatu, saya akan memberitahu anda kelebihan GitHub yang anda perlu membutuhkan di konsol dan kami akan membuatnya bersama-sama. Ini masih sebuah perkara yang baik. Kerana jika anda membutuhkan kerja anda pada pertolongan biasa, anda tidak perlu risau jika anda membutuhkan sesuatu kerja kerana kerja anda boleh membantu anda dan memutuskan kerja anda. Kami akan memberikan sedikit masa sehingga saya dapat indikasi dari kerja asisten yang semua orang membutuhkan di cloud 9 dengan pilihan. Jangan beritahu saya bahawa pilihan GitHub anda membutuhkan sesuatu. Ya. Pilihan kerja yang baru menggunakan tempat kerja. Tempat kerja yang mempunyai logo dan Ruby. Jadi, tempat kerja yang anda patut menggunakan sebenarnya disebabkan Ruby, tetapi logo disebabkan kerja. Bukan tempat kerja yang mempunyai tempat kerja. Baiklah, ini 1.35. Saya harap semua orang mempunyai pilihan yang membutuhkan sedikit masa untuk membutuhkan pilihan kerja, sehingga kita akan membutuhkan pilihan kerja yang lain. Pertama yang pertama kita akan buat sebelum kita membuat apa-apa yang lain adalah kita akan memperkenalkan pilihan GitHub di dalam projek kita. Jika anda tidak familiar dengan GitHub, GitHub adalah sistem pilihan versi jadi anda boleh membutuhkan kerja anda pilihan pilihan pilihan. Dan jika sesuatu terlalu salah, anda boleh selalu memperkenalkan pilihan pilihan kerja anda. Ini adalah pilihan yang kita akan membutuhkan, tetapi kita akan membuatnya bersama di IDE. Sebelum kita membuat itu, mari kita lihat bagaimana pilihan IDE. Pilihan besar yang ada pilihan pilihan IDE adalah pilihan pilihan editor. Ini adalah di mana anda akan melihat konten pilihan anda dan pilihan pilihan dan pilihan pilihan. Dan apa yang anda lihat di sini adalah konten pilihan pilihan Readme Markdown. Ini adalah pilihan pilihan pilihan. Jika anda melihat projek di GitHub, ini adalah pilihan pilihan yang anda akan melihat di website GitHub. Tapi kita akan memutuskan pilihan itu. Sekarang tiada pilihan pilihan di sini. Untuk jalan-jalan anda ada pilihan pilihan pilihan. Ini adalah pilihan pilihan pilihan pilihan pilihan. Dan semua perkara ini di dalam dibuat untuk anda dengan pilihan pilihan. Jadi mulai dari atas dalam folder app adalah semua pilihan yang kita akan menulis diri untuk membuat pilihan kita. Pilihan pilihan BIN, anda tidak perlu risau. Folder konfig mempunyai konfigurasi pilihan kita. Kita tidak akan mengubah apa-apa di sana. Di dalam folder DB kita akan mencabar beberapa pilihan yang berhubungan di database. Satu pilihan yang menjadikan pilihan kita dan pilihan lain yang menjadikan pilihan yang dibuat kepada database kita. Tapi kita akan mencabar itu juga nanti. Di folder lib, kadang-kadang anda akan mempunyai pilihan dari pilihan lain. Kita tidak akan menggunakan pilihan itu. Pilihan log mempunyai pilihan yang menggunakan pilihan log dari aplikasi rail. Kita tidak akan menggunakan pilihan. Pilihan html yang tidak mempunyai pilihan Ruby. Pilihan test, tidak perlu risau tentang pilihan TMP dan pilihan vendor juga tidak perlu risau. Pilihan gem adalah penting. Kita akan datang kembali nanti. Dan pilihan readme adalah penting untuk mempunyai pilihan projek anda di GitHub. Di bawah pilihan ini, anda mempunyai pilihan yang lebih jelas, yang adalah pilihan termina. Ini sama seperti pilihan pilihan termina yang anda mempunyai pilihan Macbook anda jika anda mempunyai pilihan Macbook anda. Dan di sini, kita boleh menulis semua pilihan yang kita boleh menggunakan dalam pilihan termina di pilihan Macbook kita. Kita akan menggunakan ini sekarang untuk menginitiasi pilihan GitHub. Kita akan menggunakan githgit space init. Apa yang ini buat, kita ingin menggunakan pilihan termina yang kita mempunyai sebagai gith repository. Kita periksa Enter. Ia menginitiasi gith repository. Dan anda juga dapat melihat perubahan kita. Ia mempunyai fragment di sini yang mengatakan master. Dan di gith, anda mempunyai konsep branch-nya. Jadi itu sebenarnya beritahu anda mana branch yang anda mempunyai sekarang. Sekarang kita akan menambah semuanya dalam projek ini untuk gith. Jadi kita menggunakan gith space add dan biasanya anda akan menambah mana pilihan yang anda mahu menambah ke gith tapi kita mahu menambah semua mereka. Jadi sebagai pilihan termina, kita boleh menambah capital A. Dan apabila saya menggunakan Enter sekarang, ada banyak output. Tidak. Tidak ada output. Kita boleh menambah status gith. Dan ada output yang saya menunggu. Jadi apabila anda menambah status gith, anda dapat melihat semua file yang anda telah menambah ke gith. Yang di sini adalah setiap file dalam projek seluruh. Jadi ada banyak perkara yang berlaku di sini. Dan penting yang kita mahu lakukan, kita mahu menambah commit yang adalah sebuah poin di masa yang kita boleh menambah apa-apa yang kita ada. Dan untuk buat itu, kita akan menambah gith lagi. Dan kita akan menggunakan commit. Dan kita akan menambah mesej. Jadi kita akan menggunakan dash m. Dan saya akan menambah mesej di dalam dua kota. Dan dengan pilihan yang pertama, commit tersebut adalah nama initial commit. Jadi saya akan menambah itu. Baiklah. Jadi commit dash m tersebut oleh mesej. Saya tidak tahu apa yang berlaku. Jika anda menambah commit, tetapi jika anda melakukannya di macbook, anda akan menambah mesej. Ini bermakna anda akan berdiri kerana anda tidak tahu bagaimana untuk menambah mesej. Jadi jangan lakukannya. Jangan menggunakan mesej dan mesej. Dan lagi, ada banyak output yang adalah semua file yang kita memutuskan. Apabila anda berada di terminal, anda dapat menambah K untuk memutuskan output. Jadi anda akan mengubah mesej dari terminal. Kita akan melakukannya. Kita akan mencari bahawa commit kita telah diadakan ke Git. Saya akan menambah Git dan Log. Git Log beri kami listan dari semua commit yang kami pernah membuat dalam repository Git. Dan jika saya menambah Git Log, saya akan melihat bahawa ada satu commit di dalam sana. Mesej ini adalah commit inisial. Saya dapat melihat bahawa ia telah dibuat oleh saya. Dan saya dapat melihat perjalanan dan masa yang commit itu telah dibuat. Jadi untuk mencari sedikit apa yang kami lakukan, kita memanjakan repository Git di dalam aplikasi kita menggunakan Git ini. Ini beritahu Git yang kita mahu menggunakan direktori ini sebagai project Git. Kita menggunakan Git Add-A untuk menambah semua file, semua perubahan ke Git. Kita menggunakan commit untuk menggunakan file dan perubahan. Dan akhirnya kita menggunakan Git Log untuk pastikan bahawa ia sebenarnya di dalam sana. Ya, jika anda ingin menjelaskan output di laptop Windows, anda menggunakan Ctrl K. Untuk Macbook, anda menggunakan Command K. Selepas kita melakukan ini, kita selamat di dalam cara kerana jika kita melakukannya sekarang, kita boleh selalu kembali dalam masa ini. Ini seperti kembali untuk kerja kita. Dan kita akan melakukannya beberapa kali pada kerja kita. Tapi jika anda ingin, anda boleh melakukannya kerja anda sebanyak-banyak yang anda suka. Selepas kita melakukannya ke dalam editor Cloud9 dan Git, kita akan mempunyai sebuah teori. Kita akan melakukan perubahan dari Rails, yang tiada masalah kecil kerana Rails mempunyai banyak teori. Ia mempunyai banyak teori dan juga mempunyai banyak konsep. Tapi kita akan cuba melakukannya sebaik-baik saja. Tapi ia mengambil banyak belajar untuk mempunyai kembali dengan Rails. Jadi, jangan lakukannya jika ia semua sedikit terkenal sekarang. Rails adalah sebuah framework. Itulah framework yang dibuat terutamanya untuk membuat aplikasi web dan membuat mereka sangat cepat. Rails sepanjangnya dibuat di Ruby. Jika anda berada di pejabat sebelumnya, anda akan tahu bahawa Rails adalah sebuah gem yang dibuat di Ruby yang dibuat di website rubygems.org. Kita boleh menggunakan gem ini menggunakan bundler, untuk menggunakan pengalaman untuk Ruby. Sebenarnya Rails adalah sebuah Ruby yang boleh diperkenalkan kerana kadang-kadang Rails sedikit terkenal. Tapi kita tahu bahawa pada akhirnya, ini semua hanya Ruby kode di sana. Kita boleh melihat kode di GitHub dan melihat kode di Open Source Repository dan kita boleh mencari kode di dalam Rails di GitHub. Tapi kita akan melihat file gem kita di editor Cloud9. Jadi di lantai file-finder, anda boleh klik jem file. Saya akan mengubah kode terma untuk sedikit. File gem adalah sebuah file yang bundler menggunakan atau kita gunakan untuk beritahu bundler mana kode yang kita nak gunakan dalam aplikasi kita. Jadi, kode yang anda boleh mencari di RubyGems, anda boleh menggunakan saya nak menggunakan ini dalam aplikasi saya. Ia nampak berguna. Anda boleh menggunakan nama jem di file jem dan apabila anda menggunakan bundle install, bundler akan menggunakan semua jem di dalam untuk anda. Anda dapat melihat di atas jem Rails. Ini sudah tentu disebabkan kita membangun aplikasi Rails. Versi ini adalah 4.2.5. Ada juga versi baru dari Rails, yang adalah Rails 5. Jadi, jika anda memulai aplikasi baru, ia boleh menjadi sebuah idea baik untuk melihat versi baru dari library. Dan dalam adik untuk Rails, ada banyak jem yang dibuat di sini. Setiap jem ada komentar yang beritahu anda sedikit tentang, oh, apa jem ini sebenarnya berguna untuk kami. Jadi, jem ini membantu aplikasi web di Rails. Kita akan menggunakan jem yang terlebih dahulu yang bercakap tentang jem yang terlebih dahulu dan jem yang terlebih dahulu di internet, apabila klien menghubungi jem dan jem yang terlebih dahulu dan jem yang terlebih dahulu jem yang terlebih dahulu dan saya rasa ini adalah jem yang paling penting untuk memahami apa yang berlaku dan ini dari perspektif software. Client biasanya sebuah browser, ia tidak perlu jadi, tapi ia biasanya. Anda masuk beberapa URL atau anda melihat beberapa link di browser anda. Request dibuat di internet. Ia datang ke aplikasi kita dan dari request itu kita beritahu Rails untuk menghubungi jem yang terlebih dahulu ke aplikasi user. Jadi saya beritahu Rails adalah framework dan perjalanan framework adalah untuk membantu kita membuat perkara lebih cepat daripada kita boleh membuat mereka jika kita menulis semua kode rubik kita. Dan ia membuat ini menggantikan anda dengan keadaan standard dan keadaan yang anda boleh menghubungi. Jadi Rails adalah framework untuk membuat aplikasi web. Dan apabila anda memilih framework, ia penting untuk memilih framework yang membuat perkara yang betul sebab setiap framework menghubungi aplikasi di setiap jenis. Dalam keadaan kita, kita menggunakan Rails sebab kita membuat aplikasi web yang adalah apa yang Rails sangat baik. Dan di korea Rails adalah sebuah pattern yang adalah sebuah pattern yang sangat popular dan ia adalah perjalanan MVC. Dan ada lain framework MVC untuk langgan lain. Jadi Rails adalah framework MVC untuk Ruby. Anda boleh memiliki perkara seperti PHP untuk PHP yang adalah langganan lain. Atau Anda boleh memiliki Django untuk Python. Jadi mereka memiliki framework yang sangat sama tetapi untuk langganan yang berbeda tetapi dalam keadaan kita menggunakan Ruby jadi kita akan memiliki Rails. Dan penderitaan MVC adalah penderitaan model perjalanan. Dan penderitaan itu adalah sebuah orang baik yang berkata ini adalah cara yang sangat berguna untuk memikirkan penderitaan kita dan penderitaan kita. Dan penderitaan MVC adalah sebuah contoh sebuah kata yang terkenal dikawal. Jadi model, perjalanan dan kontrol adalah setiap kata-kata yang berbeda dalam aplikasi. Dan setiap kata-kata adalah sesuatu dari perspektif teknikal. Model adalah menggunakan untuk menggunakan objek dalam aplikasi anda. Jadi dalam keadaan kita akan memiliki aplikasi TineTweet. Samples of models could be for example tweet and comment. So they are essentially the nouns that you would find in the domain for which you're building an application. The model can also describe relations between these objects. In our tiny tweet application we will see that comments belong to a tweet. Because we want to be able to model comments on individual tweets. The model is sometimes also responsible for storing data in the database. And in Rails it's responsible for even more things like validating that data before storing it. The view, the second layer is responsible for presenting the data to the user. Also known as the user interface. And in Rails this is basically HTML templates. But these HTML templates have Ruby code inside so that we can make them dynamic and put our own content inside. So when a user visits a page in our application the view is turned into an HTML page that is sent to the browser. Here we need something to connect these two. So we have the models which represents our objects and stores those in the database. And we have the views which are the HTML templates that say what the page looks like and sends that over to the browser. The controller sort of sits in between. So it access a very thin layer of glue that connects the two. And this controller is what receives the request from the browser. And based on that request we know which view file we need and we also grab the models that we need from the database. One more thing is that Rails follows something called convention over configuration. And this essentially means that it is usually very important that you get the singular or the plural form of the model right. Because if you don't the application won't work. The benefit of this is we can be less explicit with Rails. We don't have to tell it all the details about where to find things. Because it finds those things based on conventions. So to recap the overview of Rails Rails is a framework which is there to help us build web applications really fast. It's written in Ruby and it's based on the MVC pattern. It runs on the server and it sits in between the client and the database where the views is what goes to the client and the models what gets stuff from the database. And it also uses convention over configuration. And as we're building we're going to constantly revisit this and see how what we're building fits in with these things. But first let's go to our Cloud9 editor and see if we can spot the MVC pattern inside the directory structure. Because a pattern is essentially a way to structure our code. So if you're back in your Cloud9 editor, we can close the gem file. We're going to look inside the app directory which has all the code that will make up the application itself. And if we look, we actually have a models directory here. We also have a controllers directory and we have a views directory. And this really speaks to how MVC is at the heart of Rails. The entire application is expressed in terms of models, controllers and views. You also have some other folders. Assets is just static files like images. Helpers is if you have convenient methods that don't belong anywhere else you can sort of dump them in there. And mailers are for sending emails. So we're going to talk a little bit more about the database. We said that the models in MVC model the objects and can also store them to the database. But the models are not the database and Rails is also not the database. If we expand our diagram from before we have the client on the far left and the internet and we have the backend server which is Ruby on Rails. That server also needs to connect to the database. Sometimes this database is in the same computer like if you have Ruby on Rails installed on your MacBook and you're building stuff on your MacBook usually the database sits inside computer but it can also be somewhere else. Rails can work with a bunch of different databases. Some of the most common ones are SQLite. If you look in your gem file you will actually find the SQLite gem in there and that is because it is the default database for Rails. This is a convenient database because it doesn't require you to install a web. The database is just a file in your project. There's also MySQL which I won't say much about but then there's Postgres which is by far the most popular database for Ruby on Rails and it is also the easiest database to use if you want to put your Ruby on Rails application on Heroku which is the third hosting platform for Ruby on Rails applications. If when you do the technical task you want to put your application on Heroku you cannot use SQLite because Heroku does not support that. So you need to change your database to Postgres. We won't go through how to do that but Cloud9 has some knowledge base articles on how to do that. So these are just different brands of database. In the last workshop we talked a bit about a relational model of databases and you work with this model every time you use a spreadsheet. So just like spreadsheets databases also have rows and columns. We also have database tables which is similar to how you can have different tabs in your spreadsheets and every spreadsheet document is like a different database. We also need a way to describe what our database looks like and this is done in a file called a schema which is a special file that goes in the DB folder in our Rails project. There shouldn't be a schema here now because we don't have anything in our database and in fact it's not there but once we create our first database table we'll also go into the schema and see what it looks like. There's also something called migrations in Rails and this helps solve the problem of describing changes to the database. So when you're working several people on one project or on different servers or on different computers you need a way to share the changes to the database and there are two naive options. One is to just share the entire database but that means we also have to shovel all the data around which usually we don't want to do. The other option is everyone goes and manually changes their database based on what the other person says but this is tedious and boring and it's also prone to errors. So Rails has this idea of migrations which says that when we make a change to our database we describe that change using RubyCode so inside our DB folder we'll also, once we add our first migration get a migrations folder and for each and every change that we make to our database a file will be added into that folder that describes the change to the database and by doing this you can reconstruct the database from scratch by just following the steps one by one and making the changes and of course this is done automatically by Rails you don't have to follow the changes manually So to recap some of the important points about the database the database store all the user data it is described in the schema file which we don't have yet but we'll have it soon and changes to the database are done in migrations and we also don't have any migrations yet but we'll have a look at them as soon as we add them there's one last part I'm going to talk about before we can dig in really deeply and start building our application and routing so if we take the layered architecture from before where we have the model and we have the view and we have the controller sitting in between those layers are the technical aspects of our application but we also have our domain objects so in our tiny tweet application we have tweets and we have comments and these are called resources in Rails and you can think of each resource as one slice out of the cake so for every resource we will have one model we will usually have one controller and each controller action will usually have a view file associated with it in Rails there are seven standard actions we can take on a resource we can do the index action which is used to list all the instances of a resource so if we want to list all our tweets we will use the index action on our tweet resource there is show which shows an individual instance of a resource so if we're interested in a particular tweet we can use the show action on our tweet resource and that resource there is new and create new renders a form for creating a new tweet and that form is then posted into create which actually creates the resource there is edit and update which works similarly edit renders a form for editing your tweet or your comment and it sends its data into update which performs the actual update and there is also the destroy action so if you want to have comments that can be deleted by the user then you can send the destroy action to the comments resource so to clarify this we're going to see how this relates to the features that we described earlier so our first feature was to view a list of tweets and the resource we need to operate on is tweet and the action we need to use is index because index shows a list of the instances of that resource the second feature we listed was we want to view individual tweets so we're going to use the tweet resource again and we're going to use the show action and finally we want to be able to comment on tweets so we're going to implement the create action for the comment resource so to see how this fits in with the browser sending requests to the server we also need to mention routes so Rails stores all its routes in the config folder there's a config routes RB file so we can go and look at that now and right now our routes file contains nothing but comments and these are examples of how we can set up routes in our Rails application but there are no routes by default so it's all commented out there's also a useful command that we can use in our terminal to list all the routes that are currently in our application so we're going to try that now I'm going to type rake Ruby library that runs commands for us going to put a space and I'm just going to type routes I press enter and after a second the microphone is still working after a second it shows me that I don't have any routes defined yet and it even tells me please add some routes in configs-routes.rb and finally it links to the Ruby on Rails official guide for how to add routes as well for now I'm not going to add any routes but I'm going to delete all the comments inside my routes file to clean it up so that you can easier see what routes we're adding later so I've deleted all the comments and I made sure not to delete the end keyword at the end of the file because if I do that it will stop working and I can run rake routes again to demonstrate a common common problem which is not saving the file and I was going to say this earlier when we talked about the cloud 9 editor but about 9 times out of 10 when you have an error that you can't explain it's because you didn't save the file and if you look at the tab of the file there's a little dot here and if it's a little dot it means you didn't save your file so you can use command S or I'm guessing it's control S if you're using Windows and now the little dot turns into a cross which means that it is saved so if you run into some problems you can the first thing you should do is to check that you have saved your file and run rake routes again and make sure to spell correctly seems like it has some connection issues with my keyboard and it still gives us the message that we don't have any routes because all we did was delete the comment for now so every route in your application corresponds to a URL that you can type in your browser so if for one second we imagine that our website then to go to the tweet index the tweet resource index action the routes that we use is slash tweet and this is where the rails conventions come in it has to be tweets plural it cannot be tweet if you want to look at a particular tweet we go to slash tweets slash which is just a number describing the ID of our tweet and it will take us to the tweet resource show action and finally to create a comment for a tweet we need the URL slash tweets slash ID slash comments and the reason we also need the tweet here is because we said that we want to comment on particular tweets the routes need to express which tweet are we trying to comment on so we will come back to routes and we will implement the routes together and we will revisit the concept but to recap resources are roughly things in your application rest which is the name for these seven actions that you can take defines the actions for the resources each resource has its own routes and routes are stored in the routes.rb file and you can list your routes using rake routes so this is the part where we actually start implementing our tiny tweets app i'm going to change my screen to be mirrored and i'm going to put my slides next to my editor we're going to start by adding a tweet model to our application and to recap first what a model is a model is used to describe objects in our application so in this case we're going to add a model that describes a tweet and this model is going to help us store data for the model in the database and before we do that i want to draw out the relation between a tweet and its comments using these boxes and arrows diagram which is commonly known as an entity relationship diagram or erd diagram so the way this works is that the crow foot on the right indicates that a tweet can have as many comments as it wants it can have more than one comment and the crossed bar on the left indicates that a comment must always belong to a tweet so we can't have rogue comments that don't belong to any particular tweet in our database we're going to use something called generators which is something that Rails gives us to conveniently create files and we're going to use the generator to create a model so Rails generates model is self-explanatory we're going to name the model tweet and then comes the tricky part we're going to give tweet one attribute which is the content of the tweet and that is going to be a string and the way we do that is by putting the name of the attribute and the type of the attribute separated by a colon so we're going to go to our cloud9 editor and we're going to type this command in together before we start typing let's expand our models directory so that we can actually see the file being created and we're going to type in the command so on the left in your file finder make sure that the models directory is expanded i'm going to start typing Rails generate model next is the name of the model which is tweet and the last part which was any attributes we want to give the model we want to give it an attribute called content attribute which is going to be a string and all this needs to go on one line on some other slides there are too many words to fit on one line in the slides but you need to type it in one line in the terminal so i'm going to press enter now and the output will tell us which files were generated by Rails so let's look at the first line it has created a file in a folder called db-slash-migrate and because we talked about migrations we know that this is the file that describes the change that we're going to make to our database to add the tweets table on the next line we can see in app-slash-models it created a tweet.rb file and i can actually see this file in the file finder on the left because i expanded my models directory i could see it being created in here you can also see that Rails automatically generated some tests for us but we aren't going to write any tests today so we can just ignore those files for now so i'm going to give it a minute or two in case someone has bumped into problems we're generating their models right we're going to take a quick look into some of the files that were generated by Rails so all the files that were generated are just Ruby files so there's nothing dangerous if we look in the db directory there's now a migrates directory inside and it has a single file all the gibberish at the start of the file is a timestamp for when it was created and i'm going to open that file this is a migration file that we talked about earlier it describes a change that will be made to our database and you definitely do not need to understand everything that goes on in here but we can take note that there's a command called create table it's going to create a table called tweets and it's going to have an attribute content that is a string type so if you think about this in the spreadsheet analogy this is going to create a new tab called tweets and it's going to add a single column and the heading of that column is content command plus let's see if i can there is a preferences so we managed to increase the font size a bit of the terminals so you can better see what's going on so to recap what this command did is it created a model file for us in app models and it created a migration file describing some change that we will make to the database and now we're going to actually make that change to the database because we have only generated a file called rails to add the table to our database the way we do this is using the command rake which is the command runner db colon migrate so we're going to do that together in the editor with a new improved font size so i've just typed in the command rake db migrates but i haven't run it just yet so what's going to happen when we run this command is rails is going to look for new migrations that have not been run yet and it's going to try to run them in the order they were created and in our case we only have a single migration and hopefully it's going to add a table called tweets into our database we got some outputs from running the migration you can see the name of the migration was create tweets which makes sense and the only command it did was create the table tweets you can also see it was super fast and if you're vigilant you will notice that we now have a schema in our db folder so i'm going to open up this schema to show you what it looks like inside the schema file we have some ruby code you can see we have table tweets it has an attribute content which is a string and it also has some timestamps that rails adds for us automatically which will hold the date and time when the tweet was created and when it was updated this schema file is nothing that you will edit manually it is updated every time we run a migration but you can always look in here to see what tables are in the database and you can see what are their attributes or columns now after running rake db migrate assuming the migration was successful we have a table in our database called tweets and that has a single column content and we're going to make sure that our tweet model is working and we're going to do that using something called the rails console if you were in the previous workshop you will have used the interactive ruby environment or IRB this is similar except this also has your entire rails application loaded inside so you can reference models so in my terminal i'll type rails console and it will give me an interactive environment i'm going to try to get all the tweets from the database which should be no tweets i'm going to do that by typing the ruby code tweet.all tweet being a class ruby class that was created for us by rails when we ran the generator and all is a keyword that returns all the records from the database and the output tells us it's loaded the tweets from the database in 1.5 milliseconds and these empty brackets here indicates that it is empty there are no tweets in our database which makes sense because we have not created any tweets and created the table so we have not added any rows yet to get out of the console use control d and it's control d even on mac i think it's also control d on windows so this rails console is very useful for you to explore the data that is in your database ensure that things are working and make sure that the data inside is what you actually expect now we're going to open up the tweet model file that was also created for us by rails it's going to be empty when we open it the class is going to be empty and we're going to add a validation to the content of the tweet and this is to make sure that our tweets are tiny and now a maximum of 20 character tweets and we want to make sure that there's actually some content present so we don't want to allow people to create a tweet that is just empty so we're going to do this together in the file finder i'll go to the app models directory and if you remember when we ran the generator it created a text.rb file which is the model file and for some reason mine is empty but i'll just type it in i believe your file should look like this it is a single ruby class that inherits from active record base and this active record base is what gives all its powers to save to the database and validate things about itself so inside the class between the class keyword and the end keyword i'm going to add a validation now by typing validate with an s at the end this is another convention that we need to follow i want to validate something about the content of the tweet so i type colon content which is a ruby symbol and then i need to tell it what i want to validate the presence of some content so i type presence followed by a colon and true so i'm telling this model should you validate the presence of your content yes you should and this ensures that we have tweets with at least one character but i also want to validate that it doesn't have too many characters it has to qualify as a tiny tweet which i define as 20 characters so i'm also going to validate the length and in this case i need to put some squiggly braces and what do i want to validate about the length i want to validate that it's maximum 20 characters i'm going to split this up on another line so that you can see it but you don't have to do that you can put it all in one line and this is a bunch of colons and a bunch of commas and some squiggly braces and in the beginning it can be hard especially the colons because symbols have a colon in the beginning and in hashes they have a colon in the end so just try to follow either my screen or the slides that you can find in the link i hope you all had a chance to get this done so we're going to test out that this actually works so the first thing you need to do is to save the file and after you save the file we use the tool we just learned about which is Rails console and we're going to try to create a couple of tweets with some different contents to see that our validations are working we're also going to add some tweets that we can use later when we are developing our views so you can see i have not saved my file because i have a dot up here so i'm going to do that now i'm going to open the rails console and i'm going to try to create a tweet so i'm going to use the following ruby code to attempt to create a tweet i use the tweet class the information mark method and i need to pass it a content and that content in this case is the string hello world i'm going to run this and see what happens and i'm getting an error i'm not sure why i'm getting this i run into some problem with cloud 9 so i'm going to try to figure that out hopefully i won against cloud 9 and it should now work so i created my first tweet in the database using tweet.create exclamation mark and i passed it the content hello world so that will be the content of my first tweet next i'm going to try the validations i'm going to try to create a tweet that has more than 20 characters so another neat thing about the terminal is you can use the up and down arrow keys to toggle through the commands that you used previously so if you want to type out a command that is very similar to your previous one, you can just use the up arrow key to get it back i stopped spring, recreated the files and restarted so i just copy the content and create anyone and i don't know why it's starting with cloud 9 files so i just try to create a tweet with the content hello there universe, how are you? and rails didn't allow this and on the first line of the error we can see that the validation failed content is too long, maximum is 20 characters so this means that the validation that we added is working you cannot create a tweet that is longer than 20 characters so the command i try to run look like this i'm also going to try now to create a tweet that has an empty content so nothing in between the double quotes to see that the validation of the presence of content is working so if it's correct this should give us an error and it looks like it does give us an error and again you will see that rails gives us an error message and it says validation failed the content can't be blank which is exactly what we wanted to happen so now that i have played around with the tweet model in my console i'm going to exit the console and recap what we have done so far so we created a tweet model using the rails generator rails generate model which also added a migration file and we added the database table by running rake db migrate we gave the model a single attributes which is content and we added a validation in the model to ensure that the content is between 1 and 20 characters and we also demonstrated how we can use the rails console to test our models and find models that are stored in our database from previously so by doing this we have taken the first small step in building our application so in terms of the MVC for tweets we have implemented the model which is a very simple model for now it just has a validation and a single attribute but in order to make this into a working application we need to also add the view layer and the controller layer next we're going to add the controller action for indexing tweets so this will give a list of all the tweets that are in our database before we do that we're going to recap what the controller is so the controller is the thin layer of glue that connects the view and the models and the controller is also the Ruby class where we implement the 7 actions that we can take on the resource the index show, create, update and destroy actions and there's also a generator for controllers so we can tell rails to generate a controller note that in this case the name of the resource is plural you need to tell it to generate a controller tweets, not tweets so we're going to do this together now I'm going to close my model and I'm going to expand the controllers directory so that I can see the file being added as I generate it and in the terminal I'm going to type rails generate controller I'm going to run this command and it's again going to create some Ruby files for us we can see here from the output that in app controllers there's a tweets controller that has been generated for us it also generates a directory inside views where we're going to put our view files for the tweets actions and it generates a bunch of other files that we don't have to worry about for this workshop so what we were working on is we want to implement the index action for our tweets resource and this index action is going to list all the tweets in our database so if we open up our tweetscontroller.rb file in the app controllers directory which was created when we ran the generator we're going to add a single method that has a single line of code in it so by doing def index we're going to define a Ruby method named index inside we're going to assign a variable called tweets the result of running tweets.all and if you remember from when we were trying out the rails console tweets.all will return all the tweets that are in our database assuming that there are tweets inside and you see the at symbol at the beginning of the tweets variable this is how rails know that it's going to pass this variable from the controller into the view file which we will be working on later so I'm going to type this in my cloud 9 editor now I've opened my tweetscontroller file it will be an empty class I'm going to define the method index and the only thing I need to do in this method is tell rails which variables should I make available to the view template we want to have a single variable called tweets that has all the tweets in the database so I use the at symbol which is used to signify that this variable will be passed to the view I will name the variable tweets I will assign to the variable using the equal sign and I will assign it tweets.all and I'm going to save this file that's is all we need to do for the controller so to recap we use rails generate controller tweets to generate the file for us inside we put a single method index and what that method is going to do is it's going to pass a variable called at tweets containing all the tweets in our database and that leaves us with just one more piece of the MVC before we can actually see our application and that part is the view so views in rails are HTML templates where you can also write code if you are in the HTML workshop some of this will be familiar to you otherwise you can just copy whatever you see on the screen before we start the view is the technical layer for presenting data to the user or the user interface we need to create our view file because it was not created for us by rails we're going to create it in the app views tweets directory and we're going to name it index.html.erb and the directory path you see here is one of the conventions of rails so it's very important that it is correct so the fact that the directory is named tweets plural is important because it maps it to the right controller the fact that the file is named index is important because it maps it to the method just created in the controller so let's go and create that file inside app views we should have a tweets directory from when we generated the controller i'm just going to right click and select new file at the bottom and the name has to be index .html .erb and erb is the name of the html templating language that is built into ruby and inside this file that we just created is where we're going to implement the html template or UI for the tweets index action which is the page that will list all the tweets in the database so if you're familiar with html you will understand about half of this so the first line is an html tag h1 which will create a heading and that heading will have the text tweets inside the second element is a UL which is an unordered list another html element on the third line we get some ruby code that we can do thanks to the erb extension that we're using erb as our template language and here you can see the at tweets variable that we are passing from the controller and we know now that inside here we will have all the tweets in our database because that's what we did inside the controller file and if you were in the previous workshop you will know that .each we loop through all the records inside tweets or if there is no record it will loop zero times and for each tweet we will create an li element which is a list element list item and we will print out the content of that tweet so after this is rendered we will have a list of tweets containing as many list items as there are tweets in the database and this less than percent and greater than percent symbols is how we tell the template that whatever is inside here is ruby code and you can also see the less than percentage sign equals sign which tells the template that it should print this out whatever ruby expression is inside will be printed out in our case it's the content of the tweet and when I'm typing all this together now I have opened my index.html.erb file and I'm going to start with the heading and when I type in the h1 tag it will automatically put a closing tag for me so that I don't forget I'm going to put the text tweets I'm going to create my list I'm going to go with an unordered list really have much of an impact now we need to do that thing where we loop through all the tweets that were passed to us by the controller so this is where the slightly more involved parts come in firstly I need to use the less than percent to tell the template that I'm going to type ruby so I created the opening and the closing tag for my ruby code and now I'm going to loop through all the tweets inside so there is a bit of ruby stuff going on here we're using the do keyword to start a block and we're using the text between the pipes to tell ruby what is the name of the individual tweets inside this loop I'm also going to add the end of the loop before I add the actual inside so that I don't forget about it later by doing this we have created a ruby loop that will loop through all the tweets that are assigned in the controller but right now it's not doing anything because this line inside the loop is blank so I'm going to add some more code here to print out the content of the tweet so to print something from ruby I still need the less than percent but I also need to add the equals sign symbol to tell it that they should print it out and in my loop I said that inside the loop each individual tweet will be known as tweet and what I want to print out is the content of the tweet and I will remember to save this file as well there are quite a few different concepts working together here let's be a bit overwhelming for some but the understanding will come and in doing that we have added all the three parts we added the model we added the controller with a single action index and we added the view for the index action which if we have done everything correctly we will list out all the tweets in our database but there is still one more thing or we can test this in our browser and that is to define our route to take us to this controller action so we need to go back to our routes file and we need to add a new resource and we do that by using the keyword resources and the name of the resource in plural as a symbol in our case we want to add the index action and we're also going to cheat a bit the show action because we're going to implement that next so I'm going to go to my routes file in my app it's in the config directory I'm going to create a route for some resources and the resources I am creating it for is tweets and I want to create the routes for index and show to begin with I'm going to save my routes file a rake command that we can run in our terminal to see all our routes so I'm going to run that now to see that our routes are actually output and there is nothing wrong so I'll type in rake routes in the terminal previously this just told me that I have no routes and it told me how to create some this time I get a different output I get a list of routes and it contains two routes you can look at the first route it points to the slash tweets URL and that URL will go to the index action in our tweets controller and that is the action that we just implemented inside the tweets controller we also added the route for an individual tweet even though we have not implemented the controller action just yet the URL for an individual tweet is slash tweets slash and then the idea of that tweet which is a number and finally there is the moment of truth before we take our first break we're going to actually test this application out in the browser and see that everything is working and if it's working you can get some good rest during the break and if it's not working then you have a chance to catch up and get some help from the coaches so first make sure that you have saved all your files in the image here you can see it's not saved because it has the dot there and once you've saved everything you can click the run project button so we're going to do that together here I'm sure that I've saved my routes file I am clicking the run project at the top right when you do that cloud 9 will tell you the URL to your app so this is a temporary URL that your app gets from cloud 9 so you can visit your app in the browser so I'm going to go to this URL in a new tab when I go to just the URL I will come to the rails default page and that is because we have not changed anything about the routes URL yet I need to go to my tweets URL which is slash tweets and if it's working you will see a web page if it's not working you will see a web page with a lot of errors on it so it looks like it's actually working hooray I have a single tweet I have a single tweet in my database that says hello world and now you can see how the final page matches to the view file that we created in that we have the heading which is tweets and we have a list with the content of the tweets although I only have one tweet now so I'm going right I will cover again how to get here so when you click run project you will get a URL in the console or in the terminal you can copy this URL you can go to it in your browser but because we are implementing the tweets you also need to add tweets to the end so that will bring you to your page just to demonstrate I went to my console and I added another tweet so you can see that it's actually showing more than one tweet we're going to take 15 minit break this is a good chance to stretch your legs and get some coffee or if something is not working to get extra help from the assistant coaches so we will resume again at 3.35 we're going to need a way to link to the individual tweets from our index page and we're going to need a way to connect to the index page from the individual tweets page from a technical standpoint we're going to need to implement the show action for the tweet resource so in terms of MVC we already have the model now we already have tweet so what we are going to need is the view and the controller for the show action so we're going to start with the controller action which is going to be similar to the index action except in this case to the view we want to pass it only a single tweet and the way we find a tweet in the database is by using the find method the find method takes an ID which is a number and here you can see a special object in the controller called params and in the params object we expect there to be an ID what is this ID coming from well if we go back to our cloud 9 editor and we run rake routes again we can see that the form of the URL for the tweets show action is slash tweets slash and then there is this identifier colon ID and when we enter this URL in the browser this is going to be a number but here it's listed as colon ID and that ID is exactly what is getting passed into the controller here in the params object so we're going to use the ID that's coming from the URL and try to find that tweet in the database it doesn't guarantee that the tweet is there because I can put any number I want in the URL if the tweets doesn't exist then Rails will render the 404 page which is not found but we're going to go to the tweets controller and we're going to type in the code for the show method so I'll go to the controllers directory and find the tweets controller underneath my index method I'm going to define show which if you recall is one of the standard actions of the restful protocol and to our show action we're going to pass only a single tweet so I still need to use the at symbol to signify that this variable will get passed to the view and I'm going to name the variable tweet I'm going to assign to it tweet.find and to find I will pass this special params object and from that params object I want to get the ID so what is going to happen when someone goes to tinytweet.com slash tweets slash a number is they will be taken to the show action the show action is going to find a tweet that has the same ID as the number as I entered and if it does it's going to render the show view template that we're going to implement shortly and that is all for the controller action is just a single line of code that assigns the tweet variable with the correct tweet now we're going to implement the view for show and there's no file for it so we need to go and create a file again in app slash view slash tweets and it's important that we name it show.html.erb because the name of the file is going to the name of the method that we defined in our controller in my cloud 9 editor I will go to the app views directory and inside tweets I'll create a new file I'll name it show.html .erb so this view template file will contain the HTML for the page that is rendered and we try to view an individual tweet and the view code for this template is going to be slightly simpler than the one for the index action because we don't need to do any looping because we only ever have a single tweet so for this page as well I'm going to use a heading and I'm going to use tweet as the text for the heading I'm going to use the p element inside the p element I'm going to print out the content of the tweet and what you see at the bottom is a helper method that renders a link for you and the first argument here is the link text that will be shown in the browser and the second argument is the URL to where the link should be going and this tweets path method is another helper method that is automatically generated from our routes file so if we look at the output of rake routes so if we look at the output of our rake routes you can see the first column says prefix and this is the prefix that is generated for the helper method so in a ruby code if you need the link to the tweets page you can type tweets underscore page which is a ruby method that will give you the link to the tweets page if you need a link to an individual tweet you can do tweet underscore path and you need to pass in the tweet so it knows which tweet to get and we're going to do this but for now let's start implementing our show template so first there is the heading and I want it to say tweet next I want a single paragraph inside my paragraph I'm going to put ruby code because we want to print the content of the tweet so I need the less than percent to indicate that this is ruby and I also put the equal sign to say print this and we're assigned in our controller is at tweet and we want to print the content of that I'm going to save this file and I'm going to see if it works in my browser so if this works I should be able to visit a url like tweets slash one and it looks like it's working in my browser I'm now at the tweets slash and there's a paragraph with the content of the tweet and the way I knew that the idea was one is this was the very first tweet that I created in my database so we can see here how our view file corresponds to the actual view of the user but now once you go to this page you're sort of stuck there there's no way to get out so we need to add a link back to the tweets page so again I need to indicate that we are using rubycode with less than percent and we want to print this link so I also need the equal sign and inside here I'm going to use the link underscore two method which is the helper method to create links the first argument is the link text that will be rendered on the page I want the link text to say tweet so I'm going to type that in but we need a second argument to tell the link which URL it should link to and now we're going to use the helper that we get from the routes file through this prefix and it's going to be tweets the prefix underscore path now I'm going to check out my show page to see that this was actually added and note that you don't need to restart your server when you make changes to files so when I go to the browser and I reload the page it should already have the changes that I made as long as I saved the file so I'm going to reload this page and you can see now a link appeared at the bottom that says back to tweets and if you hover the link you can see the URL that was given to us by the tweets underscore path method and if we click the link it takes us back to the index page with the list of all the tweets so now our entire app consists of two pages one is the tweets index page that lists all the tweets in the world and the tweets show page which lists an individual tweet one problem now is there is no way to find the individual pages without actually knowing their ID so we're going to link to the individual tweets from the index page so you can click the individual tweets and you will go to that particular tweets page this is the tweets index view template that we created earlier with the loop that loops through all the tweets and here we have modified this code to also use the link to helper and it's going to use the content of the tweet as the link text and it's going to link to that particular tweet using the tweet path helper so I'm going to go to the cloud 9 editor and show how we go from our current index template to one that links to the individual tweets I'm going to look in the app views tweets folder and I'm going to open the index template that we had from before and in here we just loop over all the tweets and print their content in a list item for now I'm going to create a little bit more space here so you can see what's going on now the part I want to change is the list items themselves where currently we are printing the content of the tweets I want to change this into a link so I'm going to start over not to confuse you and I'm going to put link underscore 2 what I want to use for the link text is the content of the tweet itself so I'll put tweet.content and I want the link to go to the url of the individual tweet so I need to use the tweet singular underscore path helper but for this to work we also need to tell the tweet path helper which tweets it is linking to because the link needs to contain the id of the tweet I'm going to save this file now in cloud 9 I'm going to go back to my website I am on the index page and I'm going to reload the index page and now if everything is correct each item in the index page should now be a link to the individual tweet so I'm going to click one of the tweets, the hello tech ladies one and make sure that it takes me to the show page for that individual tweet I'm also going to try the link back to the index page to make sure it's working the index view file so this is essentially the same index view as before we have changed the part that prints out the tweet.content you can see to the left there is now the link to method call and to the right there is also the tweet path helper but it is still in the same index view file and by doing that we have already completed the three features that we set out to build at the beginning of this workshop we can now see a list of all the tweets which is the index action and we can also view individual tweets which is the show action so now could be a good time to after making sure that it's working commit your work into git so that your work is saved and if you try down the line you can always restore it to that point now that we've finished our first two features it's time to attack the last feature which is adding comments to individual tweets this is going to be slightly more complicated than what we did we're going to cover some new concepts which is relationships between models and we're also going to have to deal with forms so we're going to need to implement the new and the create actions for the comments resource so to recall from earlier this is what our ERD looks like this is a very simple ERD where we have a tweets resource and we have a comment resource the relationship between the two is that a tweet has many comments and a comment belongs to a tweet we've already implemented everything we need for the tweet resource in the two previous features so we're going to focus on the right side which is the comments and just like for the tweet resource and any resource we're going to need a model sometimes a controller and view templates for the controller actions but we're going to start creating the comment model and this is a bit of a recap from earlier we're going to use the generator and we're going to tell it to generate a comment model the comment model will also have a content which is a string type but we need a way to tell the database that this comment belongs to a tweet and to do that we need to add a special attribute so the attribute name is tweet which is important because it tells it to reference the tweet model so this is one of the conventions we talked about earlier and the type is a special type called references and this helps the database stitch everything together under the hood and make sure that comments always belong to tweets so we're going to type this into the terminal together Rails generate model all this is the same as it was for the tweet model but we're going to generate a comment and then we're going to list its attributes we'll have a content attribute which is a string and we're going to add a tweet attribute which is references and when I run this again we get the output and we can see that it created a migration file in dbmigrate called create comments and we know now that when we run our migrations this will create a comment table in our database and it also added the model file in app models which you can see in your file finder together with the tweet model so I'll just have a quick look into the migration file which it looks like similar to the tweet migration it creates a table with a string column called content and a special column called references that links it to a tweet and we need this for the database to keep track of which tweet was this comment added to not that all this goes on one line but in the slides without making the text too small to read so just make sure it all goes in the same command again once we generate migration we need to run rake dbmigrate to tell rails to run the new migration and add the table to our database when we run rake dbmigrate so we can see that only one migration is run and this is because rails keeps track of which migrations we run so when we add a new migration we don't have to run all the migrations that came before it and in this case the name of the migration was create comments and it created a table called comments now we're going to add a similar validation that we did to tweet to our comments model in this case we're just going to validate that it has some content we're not going to limit but there is also something else here which is how we tell rails that there is a relationship between comment and tweet and we do that by using the belongs to keyword so all comments have to belong to a tweet we're going to edit our comment model together so in app models i should find my comment.rb file and you can see when we use the generator we told it that comment should have an attribute called tweet and it's of type references because we did that rails put this code in the model for us without us having to do anything else so we're just going to go and add the validation to make sure that comments have content so that people post empty comments to your tweets so we use the same validate keyword as before we're going to validate something about the content and what we're validating is the presence which should be true i'm going to save my comment model there's still one more thing we need to take care of we have now told comments that it belongs to a tweet but we haven't told the tweet what it's relationship is to comments so we need to go back to our tweet model and at the top we're going to tell it that it has many comments and we call this a one to many relationship because one tweet has many comments but a comment can only ever belong to one tweet there are also other types of relationships like one to one or many to many so that's all that's involved in setting up our models we created the comment model we migrated the database to make sure the table is added we added a validation that comment must always have a content and we also said that comment belongs to a tweet and a tweet has many comments and we're now going to use the console again to test that our relationship is working correctly so i'm going to type in rails console i'm going to find a tweet in my database and i don't care which tweet it is i'm just going to take the first one so tweet.first and i'm going to string onto this .comments so once i find a tweet i can call .comments on that tweet to get all the comments associated with it and in this case the empty brackets at the end indicate it's empty because our first tweet doesn't have any comments yet not here that if you have no tweets in your database this will turn into an error because when you do tweet.first we expect a tweet to be returned but if there are no tweets to return it will be something else instead and when you try to call comments it will result in an error but as long as there is a tweet if there are comments or not if there are no comments we will just get an empty collection of comments if we had comments in our database we could have found a comment and we could call tweet on it to get the corresponding tweet as well and that is everything involved in setting up the model we're now going to add the form for adding a new comment and this is going to be a little bit special because we're going to put this form on the tweet show page so we're not going to need a separate view template for this and we're also not going to need a controller action for comment new and this is because this is already handled by the tweet show where we're putting the form on the same page and this is going to get a little bit involved with our view templates again once we need to render a form which is going to require some Ruby code but if you look at the first two lines this is the content that is already in the tweet show page it is the tweet heading and it's the tweets content so if we go to our page it is this page the link back to the comments page is not at the bottom i excluded it because there was too little space so what is new here is everything below the second line which is another smaller heading with the text new comment and then all this stuff here which is how we create the form to create a new comment to get started we first need to open the correct view file so remember we want to put the form to post a comment on the tweet show page so we're going to go to the views directory tweets and show and we have the code that we put in here already i'm going to make some space between the content of the tweet and the link back to the tweets page which is where we're going to put our new comments form i'm going to start with the heading i'm going to make it an h2 which is slightly smaller than an h1 and the heading i'm just going to put new comment and now comes the slightly tricky part which is to actually put the form on the page so to give you an idea our form will have a text area where you put the content of your comment and it will have a submit button so it will have those two things so to start creating a form we need to work with ruby code so the less than equals less than percent and i'm going to put equals because we need to print the form and then i'm going to use another helper that is called form underscore for the first argument to form for is which model do we want to create a form for or which resource in our case the second argument is the url to which we want this form to be posted url colon i'm going to use a path helper that we have not created yet and it's it is tweet underscore comments underscore path and i need to pass the tweet to tell it which tweet should i link to because we want to post this comment to a particular tweet i'm going to use a ruby block to render this form and i'm going to end it so these two lines that we just added will render the form itself but we're still not rendering any input fields we're going to put the two input fields that we want, the text area and the submit button in between here inside the ruby block i'm going to create some space so you can easy to see again this is ruby code and we want to print it out so i'll use less than percent equals we're inside a block and between the pipes i told it inside the block we will refer to the form as form so i'm going to type form dot text area and i'm going to tell it that this is a text area for the content and underneath i'm going to render the submit button which is just form dot submit so i'll give you a while to double check that everything looks correct in your in your tweet show view file and this can look a bit daunting at first but it contains ruby and it contains new methods added by rails that we're not familiar with but it reads kind of well so we say that we want a form for a comment and we tell it which url we want it to be sent to we want the form to have a text area for content and the form to have a submit button the trick is to get all the punctuation in the right places once i've saved my tweet show view template and load the show page to see that there's a form actually being output and that there are no errors so i'm on one of the show pages and i'm just going to reload it and it seems like i mistyped something oh no we have not created the routes yet so we cannot use the tweet comments path method now there is one shortcoming of our UI which is that once we create comments we cannot actually show up on the page so i'm going to add another section just underneath the new comment section that looks very similar to the tweet index template but in this case it loops through all the comments for this individual tweet and it prints out the content of that comment so essentially if you look at the new comment section it is actually the new section for comments and if you look at the bottom comment section it's actually the index section for comments but for convenience we want all this to be on the same page we don't want a separate page for a tweets comment which is why we're putting it all in the tweet show view template so i'm going to add yet another section which is going to be the section where we list out all the comments that have been made on this tweet so i'm going to start with a heading and i'm going to call it comments i want the comments to be displayed in a list and inside i'm going to loop through all the comments similar to what we did in the tweets index this is Ruby code so we use the tweets as the entry point because we are on the tweet show page we can still access at tweet which we did at the top when we printed the content and to get to the comments we can do tweet.comments and then we're going to use each and inside we're going to refer to it as comment so this line of code starts looping and i'm going to call the comments for this tweet for each comment i want there to be a list item and inside the list item i want to print out the content of the comment so now our tweet show page should have 3 sections stacked on top of each other first is the content of the tweet itself second is the new comment form with its own heading and third is a list of all the comments that have already been made on this tweet at the very bottom there is still the link back to the tweets so now our tweets show page actually has 3 views in it it has the tweet show view, the comment new and the comment index and if you haven't gotten all of it down yet you can refer to the slides link so we're going to create the route which this form is going to post itself to now because comments belong to tweets we need to nest the route for the comments inside the tweets route and the way we can do this is we can tack a block onto the end of the tweets resources declaration and we can put the comments resource route inside and this will generate a route that also has the tweet identifier in it so i'm going to go and add this to our route file in config routes from before we have our tweets resource routes we currently have 2 routes in our application at the end of this line i'm going to put do block and on the next line so we remember to close the block inside the block i'm going to put a line that is similar to the one we already have i'm going to type resources this time i want to define routes for comments so i type colon comment and we only want the routes to create and we don't need the new route or the index route is because we're displaying the comments on the tweets show page so they don't need their individual pages i'm going to save the file and i'm going to run rake routes again and now a third route has appeared on the top its prefix is tweet comments which you might recall we used inside our view tweet comments path you can see that the controller action is comments create and you can see the url is of the form slash tweets slash tweet id which is the number in the url slash comments and this is the third and final route that we need in our application and with that there remains only one thing we have the model now for the comments we have the views they have been put in our tweet show page we have the routes now we just need a controller action which can take the content of the form and store it into our database so we can retrieve it later and this is going to be the most complicated bit of the app that we're building today but hopefully we can get through it together so we're going to be working in the comments controller which means we're going to have to make a comments controller so i'm going to use rails generate controller comments after i do that rails will create an empty comments controller class and the file is going to be in app controllers and be named comments underscore controller.rb in this controller we're going to implement a single controller action which is the comments create action and this action will take the content of the form that is currently on the tweets show page and it's going to store the comment into the database we can also see now that we have added our route our tweet show page starts working again so you can clearly see the three sections the first section with the heading tweet which shows the tweet the new comment section and the comments section which is currently empty because there are no comments on this tweet yet inside the comments controller i'm going to start defining the create action by typing def creates and this is where we're going to put all ruby code that stores the comment into the database before we do that we need to add another thing and this is security feature in Rails that says it won't accept any form data until we explicitly tell it to accept it to do that i'm going to put a private key word you don't need to worry about that for now underneath i'm going to define another method called underscore params inside this method we're going to tell Rails explicitly which form fields are we going to accept and the reason why Rails forces you to do this is so that people can't send any data that they want and do bad stuff to your application so i'm going to start by typing out the params keyword which is the special params object we're going to require we're going to require that the params are for a comment and we're only going to permit one thing we're only going to permit the content and when we send the form data to this controller action we're going to use this method to filter the data so that there's only a comment with a content that is permitted to come in so this can be a bit tricky to get right so what's good to remember is that this params the params object matches the shape of the form that we created in the view so if we have a quick look in the view file of the form we can see it's a form for a comment and it has a single attribute called content and if we check in our function that whitelist it requires it to be a form for a comment and it permits only the attribute content I'm going to take this step by step because this controller action is going to be more complicated than the other ones the first thing we need to do in our controller action is to find the tweet for which we are storing a comment and this looks almost identical to the code in our tweet show page except the params says tweet ID instead of ID and this is because we are not in the tweets controller we are in the comments controller so if there is an ID in the params it will be an ID of a comment but in this case we want the ID of the tweet which is tweet ID another way we can see this is by looking in the rake routes output if we look at the URL that is generated that has the params fragments in it we can see that for tweet comments the fragment here is actually labeled as tweet ID so as a general rule when you're working with a controller the params ID refers to the resource of that controller so in this case it will be a comment so we're going to type the first line here we're going to assign tweet to be equal to tweet.find params tweet underscore ID I can also mention if the find method does not find whatever model we're asking for in the database with that ID it will create an error which is what we want here because if we don't find the tweet we don't want to create a comment in the first place and this works with our tweets page so if I try to go to a tweet with an ID that I know is not in the database like 123 we get an error that says couldn't find tweet with ID 123 and we're running this in development mode so we get this huge but very helpful error message if you're running this live in your website you will just get a 404 page so the first part of creating a comment for a tweet is to find that tweet next we're going to actually create the comment and we're going to do that in two steps we're going to build it and we're going to save it after we have done that we're going to redirect the user back to the path of the individual tweet we generally don't want view file for the create method normally you want to take the user back to some page where they came from or you want to render some other view file so we'll type this together in the first line we find the tweet for which we want to create a comment now we're going to use that variable that contains the tweet we're going to go to its comments collection and we're going to build a new comment and we're going to build it using the white listed form data that we defined underneath so I'll just put comment params and we're going to save that so what we're doing here we're taking the tweets which we found using the tweet id we're looking at its comments we're building a new comment object and then we're saving it or we're attempting to save it if the comment object doesn't have any content then it won't be saved because we added the validation that comments need to have our content and all this is only possible because in our models we defined the relationship between the two we said that a tweet has many comments which makes this comments collection available through the tweet in the end if we don't do anything more Rails by convention will look for a create.hml.erb file in views comments but we don't want that we want to redirect back to the page of the tweet where we created the comment so we're going to type redirect to and we can use the path helpers so tweet underscore path and we want to redirect to the particular tweet that we tried to comment on and this is our first version of the comments create action read from the top to the bottom we find the tweet for which to create a comment we build a comment and we save it and then we redirect back to the path of the tweet so i'm just going back to my page and i'm going to try to create a comment and see if we got everything correct or if there are any errors so i'm just going to put some text and click save comment and you can see well hello now shows up in the comments below so i'm going to add another comment to make sure that we actually can see all the comments is working now i'm going to try to submit an empty form to see what happens so when i do that it looks like nothing is happening and that is because if it fails to save it will still just redirect back to the same path and we do have a bonus section at the end which is going to show how can we provide some feedback to the user about what happened right now if we successfully add a comment it will show up in the list but if we try to create an empty comments it won't tell us anything which is a bit confusing to the user what's going on but first i'll give you all a chance to get your create action in order we're going to give it 5-10 minit for everyone to work out their initial create action and then i think we still have time for the bonus section at the end like i mentioned at the beginning there's no feature to add new tweets yet and the reason is we went and implemented this comments create which is actually more complicated than a tweet create action would be so it's a natural exercise to go and try and implement the tweets create action using what you have learned from the comments create and it's going to be easier because tweets don't belong to anything so you are not going to have to find a parent object we do have one last bonus section which is an enhancement to the create action and that is to provide some feedback to the user whether creating the comments was successful or not we're going to go through that the last 30 minit or so of the workshop we're going to take a look at the technical task and try to connect back some of the things you need to do in the task to what we have learned today and we can also take any questions that you have about the technical task but before that we're going to add something called flash messages flash messages is a convenience that rails adds that helps you give feedback to the user about the actions that they have taken in your application and what the status of those actions are so just like we have the params object that gives us data from the url and from forms we have a flash object that can give messages back from the controller to the view but for rails to display this we need to explicitly tell it to print these flash messages so we're going to go into what is called the layouts file so under the views directory there's another directory called layouts and inside there's an application .html.erb and this is an HTML file that is rendered for every single page in your application it doesn't matter which resource it is or which controller action it is this is going to be rendered and where you see yield this is where the individual view files are rendered so if we go to this twits index action the content of this template is going to be replaced in here but now we want to work with the flash messages and we want our flash messages to show on all the pages so we're going to put them directly into our application.html.erb view file so we're going to need some ruby code so we have this magic flash object that can bring us messages from the controller we're going to look at each flash message and this object is a hash so it actually has keys which is the type of flash message so you can have any number of types you can name them anything normally they are named stuff like error or not notice so we're going to put type and the value is going to be an array of messages so you can have any number of messages basically if you have error messages you can have more than one we're going to put this in a div tag each message in its own div tag and the way we do that is we use the content underscore tag helper and at the end we will assign the css class the type of the flash so that you can style them differently if you want in your application maybe you want error messages to be red or something like that so this is also ruby code and we want it to be printed i want a div tag i want the content to be the message and i want the class to be the type of the flash message to explain what this does if we set any flash messages in our controller any page we go to is going to look through those flash messages and if there are any it's going to print them out at the top of the page in their own div containers once we have done that we need to modify our comments controller slightly so that we display different messages when the saving of the comment was successful and when it's not successful and the case where it's not successful is when there is no content we need to go back to our comments controller so instead of saving immediately i'm going to assign the comment that we built to a variable and i'm not going to save it right away and here i'm going to do an if else statement that says if if this is true it will go into the first branch if it's not true it will go into the second branch save the comment and this save method if it successfully saves the comment it will return true otherwise it will return false and that allows us to use it inside the if statement i'm going to use a new variable called message and in this branch we will only end up if saving the comment was successful because comment.save will be true but save is successful and if it is i want to show a notice so this is the type of the flash message and you can choose any name you want but i want to use notice and i will say that the comment was saved in the case that it's not saved i want to tell the user what was wrong now in our case there's only one thing that can go wrong which is that they didn't put any content but i want a more generic way of telling what went wrong so i'm going to say that the message is an error then i'm gonna take any errors that are on the comment model and i'm going to make a sentence out of them and Rails let's me do this through some neat helper methods that you can chain together i'm going to start with comment.errors and i want the full messages and i want to turn those into a sentence so when you get comment.errors it is a list of error objects but we actually want the messages so we need to get the full messages and two sentence makes it so that if we have more than one error we will actually concatenate them together with commas now in our controller we are always assigning this message if the comment is saved we are assigning a notice if it's not saved we are assigning the errors and now we just need to pass this to the view and we do that through the redirect to by saying flash and passing it the variable that we assign and now hopefully we will get a completely unstyled error message if we are correct so you can see at the top when i try to submit a comment that doesn't have any content it neatly prints out content can't be blank and this is exactly the same message that you would get in the console if you try to create a comment if i create a comment that is valid we should get another message i'm going to try to save this comment now it says comment saved at the top so here is the full code for your comments controller create action with the flash messages unfortunately i can't show this and the code for the application view file at the same time let's put it in the slides as well we're going to let you have 15 more minutes or so to work on your application if you want to add flash messages you can try to do that if you want to add an action to create tweets that's also another nice thing that this application could have and after 15 minutes we will go through the technical task and take any questions about the technical task before wrapping up the workshop let's go let's go okay okay we have about 15 minutes of time left so we're going to finish up the programming part of this workshop and i think you all deserve to give yourselves a round of applause so you have implemented your first web application and we actually built 3 features which if you work in a company 3 features is a pretty good working day most of the time so we're going to talk a little bit about the technical task and see what Elisha has cooked up for you and we're going to try to see how does what we did today fit in with the technical task and we will also take any questions about the technical task that you might have so the outline of the technical task is in the tech ladies github repository so you can probably go and bookmark this repository because there is a lot of other important stuff in there as well so i'm going to open up the repo i'm going to zoom in a bit so the technical task is a prerequisite if you want to apply for the actual tech ladies boot camp by completing the technical task it ensures that you have the required prerequisites to be able to complete the boot camp and because there are limited slots i think there are only 6 slots for this batch the coaches will use the technical task to select the applicants together with their submitted profile so reading here it says that the task is to create a personal website with ruby on rails so there is already some synergy with what we've done today because you have to build it in rails that has enough visual design to guide users to viewing and using the website we didn't get a lot of that today and you may use as many gems as you wish to help you create the website so one gem that is sort of an easy win is a gem called bootstrap which was created by twitter and this can actually help you with the visual side of things for a very cheap price so bootstrap gives you a bunch of standard components that were created by twitter so you don't actually have to implement all the html and css and javascript so you'll see all sorts of different components here and it even has alerts so you can style your flash messages with this so that your personal home page needs to have a home page with a photo of your choice there should be an about me page where you describe more about yourself in a couple paragraphs and embed a youtube video of yourself telling us why you want to be in the bootcamp and if you're too shy it says here you don't have to actually add a video of yourself there should be a contact me page with an email address and a link to your github page and there should be a blog page and this is where what we did today comes in there should be a blog page where you can include some blog posts and note that you don't need to ensure that only the admin has the ability to create blog posts and we also did not add a user model in the app we built today but the app we built is actually very similar to the technical task only that we created tweets and in the technical task we will be calling them blog posts so your blog should probably have a blog posts resource with a blog posts index page and a blog posts new and create page and there should be a navigation bar with hyperlinks to all the above pages so these five things are the required for the app and then there are also some bonus tasks underneath and I think none of these are related to Rails most of them are just adding more front end stuff in terms of HTML and CSS and bootstrap components but there is also a bonus point if you manage to publish your personal website to Heroku but if you remember from earlier today you can't publish your Rails app on Heroku if you're using SQLite you have to use Postgres so you need to go and figure out how to change the database to Postgres to be able to do that and Elisha also created some examples of what your page might look like so this is the homepage I believe it has the navigation bar and it has the photo you have the blog page so this is essentially the blog index action there is the blog posts new which renders a form to create a blog post so this differs a bit from our tweet that it also has a title which is also a string so you will have two attributes on your blog post which is content same as the tweet and title and there is an instruction of how to submit your entry you can submit your code through GitHub by pushing using Git push or you can share it as a zip file using Dropbox or Google Drive you need to create a submission through the TechLadies website and I believe you need to do all this latest on July 3rd and I'm looking for someone to correct me if I'm wrong I believe it's July 3rd so given that do you have any questions about the technical task there are no questions about the technical task this was much easier than I imagined because I'm also not sure if I have the answers to any questions about the technical task so quick recap personal website with a photo and a navigation bar blog index page blog new action which means you also need a blog post create action and because of our choice of application today you should be able to retrofit a lot of your code to create this but I would recommend starting a new Rails application and name the models properly because otherwise when reviewing the coaches will see that the model is named Tweet and they will know that you used the code from the workshop that is all is there a host who wants to say something would you like to say something before we wrap up I think we still have 10 more minutes that we can keep I have indications group photo so how do we everyone comes up here oh there's a question the code clinic is next Wednesday the code clinic is a place where you can come and get help with the technical task by the way it is not a workshop it is just a place we go to ask questions and there are two code clinics so these are the code clinics can this an important date take note 21st June and 27th June then okay let's see application closed on 3rd of July okay for the technical task oh is it answer okay anyway it's recorded so y'all can actually find this on youtube on facebook on TechLadies facebook page okay so ya you can join the facebook group TechLadies group ya take note of this link so if you have any questions you can post here okay i think i should also send y'all a survey that y'all have to do ya so just help us fill out the survey form as well okay that's it so i think this facebook link is more important so if you have any questions or what can just ask on the facebook page so before we leave please so everybody come to the front we just take it