SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 281 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

In this case, we should
call the following:
Cow.revisions_for 1
which will give us all of the changes we??™ve ever made to the Cow with an id of 1.
These are the basic building blocks for extending, not just Active Record, but any Ruby
class. Metaprogramming is a powerful tool that Ruby provides eagerly to everyone, and it can
create some very clean and easy to read code. Likewise, Active Record gives you a lot of information
about your database and its contents. You can use these two features together to create
nearly anything, from simple helper methods to automatic, transparent database connection
pooling.
Don??™t Shoot Yourself in the Foot
Active Record hands you a lot of power in manipulating your data. While it gives you methods
like acts_as_tree out of the box, the fact that it is written in Ruby means you can write your
own methods that can grant a wide array of functionality with very little code.
While being able to modify Active Record is powerful, it??™s also potentially problematic.
Being able to open classes and redefine methods is very useful, but you can easily overwrite
necessary functionality by accident.


Pages:
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
Budowa hal przemysłowych free music ! senniczek Michał Kozal hosting gier