Top Banner
Rails Antipatterns или Работа над ошибками
21

Rails Antipatterns by Ihor Novak

May 09, 2015

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Rails Antipatterns by Ihor Novak

Rails Antipatterns или

Работа надошибками

Page 2: Rails Antipatterns by Ihor Novak

- DRY- Conventions over configuration- REST

Page 3: Rails Antipatterns by Ihor Novak

- RTFM- KISS- Do not reinvent the wheel- Write tests

Page 4: Rails Antipatterns by Ihor Novak

git

• Use small commits

• Do not store dead code• Gemfile.lock, schema.rb in VCS

Page 5: Rails Antipatterns by Ihor Novak

Coding style rules

• github.com/bbatsov/ruby-style-guide

• github.com/bbatsov/rails-style-guide• Use ruby1.9 syntax if possible

• Avoid =begin...=end comments

Page 6: Rails Antipatterns by Ihor Novak

Use ready solutions, Read API

• Implement emails sending using ActionMailer

• Sendgrid post event url• Sendgrid EventAPI, batch mode

Page 7: Rails Antipatterns by Ihor Novak

ActiveRecord

• Implement eager loading (:include statement)

• Use attr_accessible• Sanitize SQL-queries• accepts_nested_attributes_for

Page 8: Rails Antipatterns by Ihor Novak

CSS

• Use assets pipeline• reset.css?

– normalizer– modernizer– initializer

• Avoid presentational classes

Page 9: Rails Antipatterns by Ihor Novak
Page 10: Rails Antipatterns by Ihor Novak

js

• Use assets pipeline• Avoid inline js• js-validation

– SVARX

Page 11: Rails Antipatterns by Ihor Novak

Configuration

• Initializers• Environments

Page 12: Rails Antipatterns by Ihor Novak

Testing

• Rspec• FactoryGirl• Remarkable• Spork• Guard• Capybara• Jasmine

Page 13: Rails Antipatterns by Ihor Novak
Page 14: Rails Antipatterns by Ihor Novak
Page 15: Rails Antipatterns by Ihor Novak
Page 16: Rails Antipatterns by Ihor Novak
Page 17: Rails Antipatterns by Ihor Novak
Page 18: Rails Antipatterns by Ihor Novak
Page 19: Rails Antipatterns by Ihor Novak
Page 20: Rails Antipatterns by Ihor Novak
Page 21: Rails Antipatterns by Ihor Novak

Questions?