rails antipatterns by ihor novak
TRANSCRIPT
Rails Antipatterns или
Работа надошибками
- DRY- Conventions over configuration- REST
- RTFM- KISS- Do not reinvent the wheel- Write tests
git
• Use small commits
• Do not store dead code• Gemfile.lock, schema.rb in VCS
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
Use ready solutions, Read API
• Implement emails sending using ActionMailer
• Sendgrid post event url• Sendgrid EventAPI, batch mode
ActiveRecord
• Implement eager loading (:include statement)
• Use attr_accessible• Sanitize SQL-queries• accepts_nested_attributes_for
CSS
• Use assets pipeline• reset.css?
– normalizer– modernizer– initializer
• Avoid presentational classes
js
• Use assets pipeline• Avoid inline js• js-validation
– SVARX
Configuration
• Initializers• Environments
Testing
• Rspec• FactoryGirl• Remarkable• Spork• Guard• Capybara• Jasmine
Questions?