I have a confession to make: Even though thoughtbot is mostly known for the work we do with Ruby on Rails, I’m a huge Django fan. Someone left the keys to the blog lying around, so I thought I’d take it for a quick joy ride around the one of my favourite Django features: class-based generic views. Firstly, just to help anyone who’s not au fait with Django terminology catch up, a view deals with a
In our protocol guide, we instruct new developers to set up an existing Rails app like this: The goal of the bin/setup script is quick, reliable, consistent setup. It is placed in the bin directory to match new Rails conventions about executables. Rails as of version 4.2.0 generates a bin/setup file by default. Here’s an example bin/setup: #!/bin/sh # Set up Rails app. Run this script immediately
Web application development/production parity can be improved by defining process types in a manifest named Procfile such as this one for a Rails app: web: bundle exec puma -p $PORT -C ./config/puma.rb worker: bundle exec rake jobs:work In production, Heroku’s Cedar stack reads process types from that file. In development, Foreman manages output streams, responds to crashed processes, and handles
RSpec is an excellent test framework with a large community and an active team of maintainers. It sports a powerful DSL that can make testing certain things much easier and more pleasant. However, there are a few features of RSpec’s DSL that are frequently overused, leading to an increase in test maintenance and a decrease in test readability. Let’s look at an example from factory_bot’s test suite
Submitting form data is a common feature of web applications – allowing users to submit their information and giving them feedback whether the information is valid or not. ActiveRecord comes with a powerful set of validators for attributes on a persisted data model. When data is not persisted, or used for other non-active record purposes, Active Model Helper Modules reduce the complexity of valida
Constants help us avoid Magic Numbers and repeated code, which violates the DRY principle. Recently, I needed to count down the the remaining characters in a text field. I limited the length of the attribute using a constant: class Event < ActiveRecord::Base NAME_MAX_LENGTH = 70 validates :name, length: { maximum: NAME_MAX_LENGTH } # ... end
If you’re using FactoryBot1, this can often happen because you haven’t updated your factory to respect the new validation. Of course, the fix is simple:
A lightweight and flexible Sass gridAsk questions on Stack Overflow and file bugs on GitHub.Find feature and API changes in the change log.Follow us on Twitter for announcements. InstallationIf you are using Ruby on Rails, Middleman, or Jekyll, install Neat using RubyGems. Just add the following to your Gemfile. gem "neat"Alternatively, you can install Neat with Bower, Ruby, or NPM. You can also u
And the result would be: Here are some live examples of what you can build with Neat. Why another grid framework We built Neat with the aim of promoting clean and semantic markup; it relies entirely on Sass mixins and does not pollute the HTML with presentation classes and extra wrapping divs. It is less explicit—as in requires fewer mixins—than most other Sass-based frameworks and comes with buil
Update: A better approach is detailed in Laptop Setup for an Awesome Development Environment. Earlier today, OS X Mountain Lion was released for all users in the Mac App Store. As a member of the Mac Developer Program, I decided to tame this wild cat early on, jumping on the beta tester bandwagon since the Developer Preview 4. Here are some of the things you should consider as you make the switch
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く