rails_sns's People
Forkers
fincdeveloperrails_sns's Issues
test
コードレビュー@そのほか
dbのcolumnには基本的にnot null制約をつけましょう!
つぎからでok!
https://github.com/ryok-0319/rails_sns/blob/master/mysns/db/schema.rb
[あったらいいななので参考程度に]
replyのlevelってちょうっと抽象度が高めかな!
なんのレベル??ってなるかなと
日本語だと「公開レベル」だとおもうので accessibility_levelとかviewability_levelとか??
rubocopいれてインデントとか気をつけましょう!
コードレビュー@コントローラ
https://github.com/ryok-0319/rails_sns/blob/master/mysns/app/controllers/relationships_controller.rb#L4
オブジェクト指向っぽくてよい!
https://github.com/ryok-0319/rails_sns/blob/master/mysns/app/controllers/relationships_controller.rb#L3
strong params
https://www.transnet.ne.jp/2016/05/18/rails%E5%88%9D%E5%AD%A6%E8%80%85%E3%82%B9%E3%83%88%E3%83%AD%E3%83%B3%E3%82%B0%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%E3%83%BCcolnr/
strong paramsをつかおう!
https://github.com/ryok-0319/rails_sns/blob/master/mysns/app/controllers/replies_controller.rb
よい!
https://github.com/ryok-0319/rails_sns/blob/master/mysns/app/controllers/tweets_controller.rb#L10
permitted_tweetってtweetが帰ってくるmethodぽい名前になっていて紛らわしいと思います
@tweets = []
# 全てのツイートのうち、条件を満たしているものだけを@tweetsに格納
permitted_tweet(@tweets, @all_tweets)
を
@tweets = Tweet.permitted_tweets(user)
とすると、modelにロジックを移せてMVCの分離という意味でも良いかと思います
https://github.com/ryok-0319/rails_sns/blob/master/mysns/app/controllers/tweets_controller.rb#L75
ここも
tweet.viewable?(user)
とかにするとmodelに移せてよいかも!
unauthorized?
だと、なんの権限(閲覧なのか、編集なのか)わからなそう
https://github.com/ryok-0319/rails_sns/blob/master/mysns/app/controllers/users_controller.rb#L6
railsdmでも言ってたけど、ここらへん、なるべくcontrollerはcrudだけに保てるとベストかと!
どうやればいいかはちょっと考えて見てもらえれば
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.