ideas_stock's People
Forkers
iwasaki-dideas_stock's Issues
kaminariの方がmofmofでは使っているかな
先に編集権限をチェックすると余計なDBアクセスを減らせる
ぱっと見、成立条件がわかりにくい
<% if [email protected]? && [email protected]? %>
否定条件を組み合わせると、人はコードを理解しにくくなる。
条件が1つだけならまだしも、組み合わせるとさらにわかりにくくなる。
できる限り、否定を使わない方がスッキリ。
<% if @memos.present? && @memos.count > 0 %>
<% if @memos.try(:count) > 0 %>
でもいい
railsのリレーションを使って書いた方がわかりやすい
current_user.books.find_by(id: {book_id})
resources :memosと被っているけど如何に?
あえて代入する必要はないかも
user = current_user
@memo = user.books.first.memos.build(memo_params)
userを宣言したけど利用していないので
@memo = current_user.books.first.memos.build(memo_params)
でいいけど、敢えて代入するなら
first_book = current_user.books.first
@memo = first_book.memos.build(memo_params)
やりたい事単位で区切って、変数に代入した方がわかりやすいかな。
リソースIDはパラメータとして扱わないほうがRails&restfulとして自然
delegeteは必要?
コントローラーはできる限り、画面描画に専念させるとベター
この手のチェック処理はモデルに書くと良い。
コントローラーは表示する画面をコントロールに専念させ、
業務ロジックはモデルに書く。
SkinnyController, FatModelがRailsの作法として基本形。
用語を検索してみよう。
そうすると色々諸説が入り乱れて混乱すると思うけど、まず基本を抑えよう。
flash.nowを使っている所が:+1
flash.nowを使っている所が:+1
redirect_toの所との使い分けは?
テストケースレビューでの指摘。
テストケースレビューでの指摘。
ここはenumにしてバリデーションは削除できる
必要なgem?
gemfileに記載するgemは本当に利用しているgemのみに書くようにしよう。
全てのgemの動きを理解する必要な無いけど、”良く分からないけどコピペ”はNG。
大まかで良いのでgemの要不要は把握しておこう。
ここは大事なところなので意識してみて。
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.