Giter Club home page Giter Club logo

sql-study's Introduction

Build Status

sql-study

Sample app for https://nishiwaki-koberb.doorkeeper.jp/events/39705

screen shot 2016-03-14 at 07 50 30

How to setup

  1. このリポジトリを自分のアカウントへフォークする
  2. ローカルにgit cloneする
  3. rbenv local 2.2.4 実行(または 2.2系の任意のバージョンを指定)
  4. bundle install 実行
  5. cp config/database.yml.sample config/database.yml 実行
  6. config/database.yml を自分の環境に合わせて編集する
  7. bin/rake db:setup 実行
  8. rails s 実行
  9. http://0.0.0.0:3000 にアクセスしてページが開くことを確認
  10. bin/rspec を実行してテストがエラーなく実行できることを確認

How to answer

以下は設問0(チュートリアル問題)の解答手順。

  1. http://0.0.0.0:3000/questions/q0 を開いて問題を確認する
  2. spec/features/question_0_spec.rb を開く
  3. xscenario になっている部分を scenario に変更する
  4. bin/rspec を実行し、テストが失敗することを確認する
  5. app/views/questions/q0.html.slim を開く
  6. = render layout: 'layouts/answer_section' do 以下のコードに注目する
  7. / 望ましくない解答例 の下にある /tabletable に変更する(コメントを外す)
  8. http://0.0.0.0:3000/questions/q0 を開いて、Exampleと同じ結果が表示されていることを確認する
  9. bin/rspec を実行すると、テストはパスするが、"[WARN] Query count: 4" という警告が表示されることを確認する
  10. / 望ましくない解答例 の下にある table/table に戻す
  11. / 望ましい解答例 の下にある /tabletable に変更する
  12. http://0.0.0.0:3000/questions/q0 を開いて、Exampleと同じ結果が表示されていることを確認する。その下に "Query count: 1 OK" と表示されていることもあわせて確認する
  13. bin/rspec を実行すると、テストがパスし、警告も出ないことを確認する
  14. 解答が終わったら、コードの変更点をコミットする

Rules

  • 変更して良いのは = render layout: 'layouts/answer_section' do から下のコードと、モデルのコードのみ。コントローラやテストコードは変更してはいけない。
  • SQL1発で求められている結果を表示できるようにする。クエリを2回以上発行したり、RubyのコードでソートやフィルタリングをするのはNG。

Suggested answers

解答例は answer ブランチに掲載されている。 ただし、これが唯一かつベストな解答というわけではない。

https://github.com/JunichiIto/sql-study/tree/answer

License

MIT License.

sql-study's People

Contributors

junichiito avatar

Watchers

James Cloos avatar Miyuki Higashi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.