concept Rails in category ruby

This is an excerpt from Manning's book Rails 4 in Action: Revised Edition of Rails 3 in Action.
Rails keeps track of the last migration that was run by storing it using this line in the db/schema.rb file:
ActiveRecord::Schema.define(version: [timestamp]) doThis version should match the prefix of the migration you just created, where [timestamp] in this example is an actual timestamp formatted like YYYYmmddHHMMSS. Rails uses this value to know what migration it’s up to. The remaining content of this file shows the combined state of all the migrations to this point. This file can be used to restore the last known state of your database if you run the bundle exec rake db:schema:load command.
In this chapter, you learned what Rails is and how to get an application started with it: the absolute bare, bare, bare essentials of a Rails application. But look how fast you got going! It took only a few simple commands and an entire two lines of your own code to create the bones of a Rails application. From this basic skeleton, you can keep adding bits and pieces to develop your application, and all the while you get things for free from Rails. You don’t have to code the logic of what happens when Rails receives a request or specify what query to execute on your database to insert a record—Rails does it for you.
You also saw that some big-name players—such as Twitter and GitHub—use Ruby on Rails. This clearly answers the question “Is Rails ready?” Yes, it very much is. A wide range of companies have built successful websites on the Rails framework, and many more will do so in the future. Rails also has been around for a decade, and shows no signs of slowing down any time soon.
Still wondering if Ruby on Rails is right for you? Ask around. You’ll hear a lot of people singing its praises. The Ruby on Rails community is passionate not only about Rails but also about community building. Events, conferences, user group meetings, and even camps are held around the world for Rails. Attend these, and discuss Ruby on Rails with the people who know about it. If you can’t attend these events, you can explore the IRC channel on Freenode #rubyonrails and the mailing list rubyonrails-talk on Google Groups, not to mention Stack Overflow and a multitude of other areas on the internet where you can find experienced people and discuss what they think of Rails. Don’t let this book be your only source of knowledge. There’s a whole world out there, and no book could cover it all!
The best way to answer the question “What is Rails?” is to experience it for yourself. This book and your own exploration can eventually make you a Ruby on Rails expert.
Ruby on Rails is a framework built on the Ruby language—hence the name Ruby on Rails. The Ruby language was created back in 1993 by 松本行弘 (Yukihiro “Matz” Matsumoto) of Japan and was released to the general public in 1995. Since then, it has earned both a reputation and an enthusiastic following for its clean design, elegant syntax, and wide selection of tools available in the standard library and via a package management system called RubyGems. It also has a worldwide community and many active contributors continuously improving the language and the ecosystem around it. We’re not going to go into great depth about the Ruby language in this book though, because we’d rather talk about Ruby on Rails.

This is an excerpt from Manning's book Rails 3 in Action.
Welcome aboard! It’s great to have you with us on this journey through the world of Ruby on Rails. Ruby on Rails is known throughout the lands as a powerful web framework that helps developers rapidly build modern web applications. In particular, it provides lots of niceties to help you in your quest to develop a full-featured real-world application and be happy doing it. Great developers are happy developers. There’s much more to the Rails world than might appear at first glance, but not overwhelmingly too much. And what a first glance! Oh, you two haven’t met? Well, time for some introductions then!
A question sometimes asked by people new to Rails is, “Is Rails ready?” Of course it is! The evidence is stacked mightily in Rails’ favor with websites such as Twitter, Yellow Pages, and of course Basecamp, serving millions and millions of page requests daily.[6]
6 Some of the more well-known applications that run on Ruby on Rails can be found at http://rubyonrails.org/applications.
If any site is a testament to the power of Ruby on Rails, Twitter is it. Even though Twitter suffered from scaling problems back in 2008 (due to its massive growth and other technological problems, not due to Rails), it is now the eleventh most popular website, according to Alexa, and is exceptionally stable.
Another well-known site that runs Ruby on Rails is GitHub, a hosting service for Git repositories. This site was launched in February 2008 and is now the leading Git web-hosting site. GitHub’s massive growth was in part due to the Ruby on Rails community quickly adopting it as their de facto repository hosting site. Now GitHub is home to over a million repositories for just about every programming language on the planet. It’s not exclusive to programming languages either; if it can go in a Git repository, it can go on GitHub. As a matter of fact, this book and its source code are kept on GitHub!
The Nginx configuration file (/opt/nginx/conf/nginx.conf) must contain the correct configuration options in order for Phusion Passenger to function correctly. This installer has already modified the configuration file for you! The following configuration snippet was inserted: http { ... passenger_root /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger- 3.0.4; passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-p180/ruby; ... } After you start Nginx, you are ready to deploy any number of Ruby on Rails applications on Nginx.

This is an excerpt from Manning's book Ruby in Practice.
Listing 1.6. Map is one way Ruby uses functional programming for parallelism
# Code that iterates in order to map one array to another application_names = [] for application in applications application_names << application.visible_name end # Code that maps one array to another applications.map { |application| application.visible_name } # An even shorter way to express it in Rails and Ruby 1.9 applications.map &:visible_name
For example, consider Ruby on Rails. Rails is one incarnation in a long series of web application frameworks. Like so many web application frameworks before it, Rails deals with UI and remote APIs, business logic, and persistence. Unlike many web application frameworks before it, it does so effortlessly, without taxing the developer. In its three years of existence, it leapfrogged the more established frameworks to become the benchmark by which all other frameworks are judged.
All that power comes from Ruby. The simplicity of mapping relational databases to objects without the burden of XML configuration results from Ruby’s combination of object-oriented and dynamic styles. The ease with which HTML and XML templates can be written and filters can be set up comes from functional programming. Magic features like dynamic finders and friendly URL routing are all forms of metaprogramming. The little configuration Rails needs is handled effortlessly using a set of domain-specific languages. It’s not that Rails (or really Ruby) is doing anything new; the attractiveness comes from how it does things. Besides being a successful framework on its own, Rails showed the world how to use Ruby’s combination of language features to create applications that, quite frankly, rock. Dynamic features like method_missing and closures go beyond conceptual curiosity and help you deliver.
So, why is Ruby popular now? This popularity can, for the most part, be traced to developers growing weary of complex, taxing development tools and to the emergence of Rails as a definite, tangible project that shows how Ruby can be used to create production quality software that’s still developer friendly. Once you start working with Ruby, you’ll probably realize this too. It takes about the same amount of effort to work with flat files, produce PDFs, make SOAP requests, and send messages using WebSphere MQ as it does to map objects to databases, send email, or parse an XML file. Wrap that into a nice, natural syntax, and you have a potent tool for software development.
“Another Ruby book that teaches Rails?” No, we’re not going that far! This chapter is not an introduction or tutorial on Rails; rather, it is a discussion of techniques related to Ruby on Rails. There’s a middle-documentation problem that’s arisen in the Rails community, and this chapter is meant to fill a few of the gaps that many other books and documentation sources leave open. We’ll cover extending the Rails framework, through library code, plugins, and more, and we’ll finish by talking about profiling your Rails code. Let’s start by looking at Rails’ helper mechanism.

This is an excerpt from Manning's book Flexible Rails: Flex 3 on Rails 2.
Figure 1.1 shows how Rails provides a standard three-tier architecture (presentation tier, model tier, persistence tier) as well as a Model-View-Controller (MVC) architecture. As the diagram shows, Rails takes care of everything between the web server and the database.
Congratulations: We’re on Rails! Leave this Command Prompt window open with WEBrick running.
I began writing this book when Rails was at version 1.1. I revised it to update it to Rails 1.2, and then I rewrote it to use Rails 2. When I was rewriting the book to use Rails 2, I used the first Preview Release of Rails 2 (rails gem version 1.2.3.7707). I then updated my Rails version to the first Release Candidate of Rails 2 (gem version 1.99.0) during the copy-editing phase of the book. Then, during typesetting, I updated my Rails version to 2.0.1. Following along with either Rails 1.99.0 or 2.0.1 will work.