As such, it can be useful debug
information.
breakpointer
The breakpoint library in Ruby allows you to call a method at an arbitrary point of your code.
If you run this program locally, outside of Rails, this will open up an Interactive Ruby (IRB)
instance that lets you debug the application at the point of the breakpoint. But if you use such
a breakpoint in a Rails application, something else happens. Because most Rails applications
CHAPTER 3 ?– INTRODUCTION TO RAILS 29
don??™t have a natural place to dump you into an IRB, the application won??™t do that. Instead,
Rails will provide a breakpoint server. The breakpointer script lets you attach to such a breakpoint
server (it works remotely too), and when the application hits a breakpoint you get an
IRB session into it. Quite neat, and very useful.
console
This script lets you start up an IRB console with the current Rails application loaded. You have
access to your model objects, all Rails helpers, and much more. You can use this script to test
how you think some method in ActiveRecord will work, or almost anything else you can think
of. When I create a new Rails application, I usually make sure always to have a console started,
because it??™s so easy to test things out. You can also use it to check on the data in the database.
Because you can execute arbitrary SQL through a model object, this means you can do mostly
anything you want.
destroy
The destroy script is the negative counterpart of the generate script, described next.
Pages:
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93