fixture_path)
Figure 3-2. Plugin testing directory structure
Further Reading | 95
Now, the test (acts_as_state_machine_test.rb) can reference ActiveRecord classes and
their fixture data just as in a standard Rails unit test.
Further Reading
Geoffrey Grosenbach has a two-part article on Rails plugins, including some information
on writing plugins. The two parts are available from the following:
http://nubyonrails.com/articles/the-complete-guide-to-rails-plugins-part-i
http://nubyonrails.com/articles/the-complete-guide-to-rails-plugins-part-ii
96
Chapter 4 CHAPTER 4
Database 4
All non-trivial abstractions, to some degree, are leaky.
??”Joel Spolsky
For many developers, Rails starts with the database. One of the most compelling
features of Rails is ActiveRecord, the object-relational mapping (ORM) layer.
ActiveRecord does such a good job of hiding the gory details of SQL from the programmer
that it almost seems like magic.
However, as Joel Spolsky says, all abstractions are leaky. There is no perfectly transparent
ORM system, and there never will be, due to the fundamentally different
nature of the object-oriented and relational models. Ignore the underlying database
at your own peril.
Database Management Systems
The Rails community has been built around the MySQL database management system
(DBMS*) for years. However, there are still a lot of misconceptions surrounding
DBMSs, especially when used with Rails.
Pages:
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150