Read the Tests
Rails has an extremely comprehensive set of tests. In fact, the tests are sometimes
more helpful than the official documentation, because the tests specify proper behavior
through code. The tests provide credible, proven examples of how to work with
the library in question. Since many of the tests are written in a Test-Driven Development
(test-first) style, they often provide more implementation details than the documentation
does.
For example, this code from ActiveRecord??™s binary_test.rb proves that ActiveRecord
is binary-clean:
def setup
Binary.connection.execute 'DELETE FROM binaries'
@data = File.read(BINARY_FIXTURE_PATH).freeze
end
# ...
Dependencies
ActiveSupport | 57
def test_load_save
bin = Binary.new
bin.data = @data
assert @data == bin.data, 'Newly assigned data differs from original'
bin.save
assert @data == bin.data, 'Data differs from original after save'
db_bin = Binary.find(bin.id)
assert @data == db_bin.data, 'Reloaded data differs from original'
end
Stay Current
Rails is a moving target: people continually contribute patches, and the core team is
always looking for ways to improve. The best way to stay on top of the fast-paced
changes is to monitor the Rails Trac timeline (http://dev.rubyonrails.org/timeline). An
RSS feed is available.
Also keep an eye on the ruby-core and rails-core mailing lists, which detail changes
being made to the Ruby and Rails core, respectively.
Pages:
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96