Ruby for Rails phần 3

Mặc dù việc thiết kế Ruby tuân theo nguyên tắc ít gây ngạc nhiên nhất, nhưng một số tính năng khác với các ngôn ngữ khác như C hay Perl: Các tên bắt đầu bằng kí tự hoa được xem là hằng, vì thế biến cục bộ nên bắt đầu bằng kí tự thường. Việc đánh giá Boolean đối với các dữ liệu không phải bool rất chặt chẽ: 0, "" và [] được xem là true: Trong C, biểu thức 0 ? 1 : 0 được xem là 0. Trong Ruby, tuy nhiên,. | 68 CHAPTER 3 Ruby-informed Rails development This chapter represents something of a pivot point. There s a lot of material coming up later two parts of the book devoted to a Ruby language tutorial and a final part that brings the threads together in a Ruby-aware second pass at R4RMusic the Rails application we created in chapter 2. Still we ve already completed one complete cycle of the breadth-first examination of Ruby and Rails and you re in a position to see more closely and more clearly how the study of Ruby can pay off for a Rails developer. The focus in this chapter is on that how and on the why. The full benefits of immersing yourself in Ruby can t and won t all present themselves in this chapter much more will emerge during parts 2 and 3 the heart of the book s Ruby tutorial material as well as during the further development of the music store application in part 4. But we re far enough along that you can clearly see by example and not just take on faith the kinds of advantages that a Rails developer can reap from a thorough Ruby grounding. The introductory About this book section listed four ways in which knowing Ruby well can serve you as a Rails developer By helping you know what the code in your application including Rails boilerplate code is doing By helping you do more in and with your Rails applications than you can if you limit yourself to the readily available Rails idioms and techniques as powerful as those are By allowing you to familiarize yourself with the Rails source code which in turn enables you to participate in discussions about Rails and perhaps submit bug reports and code patches By giving you a powerful tool for administrative and organizational tasks for example legacy code conversion connected with your application As stated back in that section the first two of these four items are the most central to this book. The main goal of this chapter is to demonstrate to you how much more meaningful and concrete those first two items already

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
8    73    2    16-06-2024
7    72    1    16-06-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.