![]() You can use the Rails DSL for these changes, or you can use SQL. You can use migrations to make any changes you need to the database(s) your application connects to. They’re also easy to share across development teams since each member of the team can deploy the migration to their local instance when they update their projects. Migrations are saved as part of your Rails project, so they’re versioned with the rest of your code. You can develop on one database and deploy to another, or deploy to a new database platform in production. So using migrations makes it possible for you to deploy your app to new platforms. If you’re working with Rails Active Records, manipulating the database directly is a bad idea.Īs we’ll see in the example below, Active Record uses migrations to update your app’s schema in schema.rb. This file is what Rails uses to deploy your application to a new database. Rails migrations are useful any time you need to make a change to your application’s database. Rails applications can evolve, and publishing a new migration with a new release of your application isn’t unusual. Each one represents a new version of your database schema. Sure, you can (and should) version your SQL files, but do they belong in the same place? Not everyone feels the same way about that question. They’re written in Ruby and versioned with the rest of your app. Migrations keep your database schema changes with your application code. Migrations avoid this since you make the modifications in platform-independent Ruby. If you have to write SQL to change your schema, you lose this independence. Rails applications that can stay within the Active Record model are database-independent. Using Rails migrations instead of SQL has several advantages. Migrations give you a way to modify your database schema within your Rails application. Requirements change all the time, and those changes often lead to database changes. Let’s take a look at what Rails migrations are, why you might need them, and walk through examples using the sample code we used to show you how to troubleshoot Ruby applications. You can roll migrations back, and manage them alongside your application source code. The code is database-independent, so you can easily move your app to a new platform. Instead of managing SQL scripts, you define database changes in a domain-specific language (DSL). Benchmark your application to determine performance bottlenecks.A Rails migration is a tool for changing an application’s database schema. Analyze your application's performance using the Rails logging infrastructure. Debug your application using the ruby_debug client. ![]() Achieve maximum code reuse with filters and helper functions. Use migrations to manage your database schema without data loss. Add plugins to easily enhance your application's functionality. Build a comprehensive automated testing suite for your application. Use object oriented concepts like inheritance and polymorphism. ![]() Implement RESTful development patterns and clean URLs. Work with databases easily using ActiveRecord. Reap the benefits of a best-practice MVC architecture. Use Rails' Ajax features to create slick interfaces. Exploit the new features available in Rails 2. Build and deploy a complete Rails web application. What Will You Learn? This book will teach you how to: Program with confidence in the Ruby language. And all code is up-to-date for Rails 2.0, so you can begin coding immediately with the latest version of Rails. By the end of the book, you'll have built a fully-featured Web 2.0 application and deployed it to the Web. ![]() The book finishes with chapters on debugging, benchmarking and deployment to a live web server. Different aspects of Rails, such as user authentication, session cookies, and automated testing are explored with each feature that is added to the application. You'll be an accomplished Ruby programmer in no time The example application that the book builds - a user-generated news web site - is built upon with each following chapter, and concepts such as sessions, cookies and basic AJAX usage are gradually introduced. An entire chapter is devoted to learning Ruby in a fun way, using the interactive Ruby console, so you can follow along at home. Want to learn all about Ruby on Rails 2.0, the web application framework that is inspiring developers around the world? The second edition of this practical, hands on book will: show you how to install Ruby on Rails on Windows, Mac, or Linux walk you, step by step, through the development of a Web 2.0 social news application, just like show you how to test, debug, benchmark, and deploy your Rails application Unlike other Rails books, this book doesn't assume that you are an experienced web developer, or that you've used Ruby before. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |