Thursday, June 24, 2010

Execute MYSQL queries in rails

we can use MYSQL queries in rails, by using the following connection method

connection = ActiveRecord::Base.connection();
output = connection.execute("select test from test_table
output.each do |row|
puts row[0]
the output will be an array

MYSQL in rails

we can use MYSQL server in rails instead of sqllite,for that we have to configure the database.yml(config/database.yml) file like this

development:
adapter: mysql
database: database name_development
host: localhost
socket: /var/run/mysqld/mysqld.sock
encoding: utf8
username: username
password: password

test:
adapter: mysql
database: database name_test
host: localhost
socket: /var/run/mysqld/mysqld.sock
encoding: utf8
username: username
password: password

production:
development

Wednesday, June 23, 2010

Rails History

Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language. It is intended to be used with an Agile development methodology that is used by web developers for rapid development

Ruby on Rails was extracted by David Heinemeier Hansson from his work on Basecamp, a project management tool by 37signals (now a web application company).David Hansson first released Rails as open source in July 2004, but did not share commit rights to the project until February 2005.In August 2006 the framework reached a milestone when Apple announced that it would ship Ruby on Rails with Mac OS X v10.5 "Leopard", which was released in October 2007.

Rails version 2.3 was released on March 15, 2009. Major new developments in Rails includes templates, engines,Rack and nested model forms.

  • Templates enable the developer to generate a skeleton application with custom gems and configurations.
  • Engines let one reuse application pieces complete with routes, view paths and models.
  • The Rack web server interface and Metal allow one to write optimized pieces of code that route around ActionController.
On December 23, 2008, Merb, another web application framework was launched, and Rails announced a commitment to work together. The Rails team announced they would work with the Merb project to bring "the best ideas of Merb" into Rails 3, ending the "unnecessary duplication" across both communities.
More...