Embed presentation
Downloaded 26 times









![Bundler and Gemfile$ bundle installUsing rake (10.0.4)Using i18n (0.6.1)Using multi_json (1.7.2)Using activesupport (3.2.13)Using builder (3.0.4)Using activemodel (3.2.13)Using erubis (2.7.0)Using journey (1.0.4)Using rack (1.4.5)Using rack-cache (1.2)Using rack-test (0.6.2)…Your bundle is complete! Use `bundle show[gemname]` to see where a bundled gem isinstalled.source 'https://rubygems.org'source 'http://gems.github.com'# Application infrastructuregem 'rails', '3.2.13'gem 'devise'gem 'simple_form'gem 'slim'gem 'activerecord-jdbc-adapter’gem 'activerecord-jdbcpostgresql-adapter'gem 'jdbc-postgres'gem 'jruby-openssl'gem 'jquery-rails'gem 'torquebox', '2.3.0'gem 'torquebox-server', '~> 2.3.0'](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-10-2048.jpg&f=jpg&w=240)














![Rails: Migrationsclass CreateInitialTables < ActiveRecord::Migrationdef upcreate_table :posts do |t|t.string :titlet.text :bodyt.string :slugt.integer :category_idt.timestampsend# … create more tables…add_index :tags, [:name,:something], unique: trueexecute “UPDATE posts SET field = ‘value’ WHERE stuff = ‘happens’”enddef downdrop_table :postsenddef changeadd_column :posts, :user_id, :integerendend$ rake db:migrate](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-25-2048.jpg&f=jpg&w=240)
![Rails: ControllersClass PostsController < ApplicationControllerbefore_filter :authenticate, only: :destroydef index # GET /postsenddef new # GET /posts/newenddef create # POST /postsenddef show # GET /posts/:idenddef edit # GET /posts/:id/editenddef update # PUT /posts/:idenddef destroy # DELETE /posts/:idendend# Routesresources :postsOR limit itresources :posts, only: [:create,:new]](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-26-2048.jpg&f=jpg&w=240)
















![Datatypes: arrays• CREATE TABLE sal_emp(name text, pay_by_quarter integer[],schedule text[][])• CREATE TABLE tictactoe ( squares integer[3][3] )• INSERT INTO tictactoe VALUES (‘{{1,2,3},{4,5,6},{7,8,9}}’)• SELECT squares[1:2][1:1] == {{1},{4}}• SELECT squares[2:3][2:3] == {{5,6},{8,9}}](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-43-2048.jpg&f=jpg&w=240)






![Further exploration: PLV8• CREATE OR REPLACE FUNCTION plv8_test(keys text[], vals text[])RETURNS text AS $$var o = {};for(var i = 0; i < keys.length; i++) {o[keys[i]] = vals[i];}return JSON.stringify(o);$$ LANGUAGE plv8 IMMUTABLE STRICT;SELECT plv8_test(ARRAY[‘name’,’age’],ARRAY[‘Tom’,’29’]);• CREATE TYPE rec AS (i integer, t text);CREATE FUNCTION set_of_records RETURNS SETOF rec AS $$plv8.return_next({“i”: 1,”t”: ”a”});plv8.return_next({“i”: 2,”t”: “b”});$$ LANGUAGE plv8;SELECT * FROM set_of_records();](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-50-2048.jpg&f=jpg&w=240)











The document explores the advantages of using Ruby on Rails with PostgreSQL from the perspective of an application developer, Barry Jones. It discusses key considerations in choosing programming languages and frameworks, the benefits and drawbacks of Ruby, as well as practical applications involving Rails, database management, and testing. Additionally, the document highlights the capabilities and features of PostgreSQL, including full-text search and various data types.









![Bundler and Gemfile$ bundle installUsing rake (10.0.4)Using i18n (0.6.1)Using multi_json (1.7.2)Using activesupport (3.2.13)Using builder (3.0.4)Using activemodel (3.2.13)Using erubis (2.7.0)Using journey (1.0.4)Using rack (1.4.5)Using rack-cache (1.2)Using rack-test (0.6.2)…Your bundle is complete! Use `bundle show[gemname]` to see where a bundled gem isinstalled.source 'https://rubygems.org'source 'http://gems.github.com'# Application infrastructuregem 'rails', '3.2.13'gem 'devise'gem 'simple_form'gem 'slim'gem 'activerecord-jdbc-adapter’gem 'activerecord-jdbcpostgresql-adapter'gem 'jdbc-postgres'gem 'jruby-openssl'gem 'jquery-rails'gem 'torquebox', '2.3.0'gem 'torquebox-server', '~> 2.3.0'](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-10-2048.jpg&f=jpg&w=240)














![Rails: Migrationsclass CreateInitialTables < ActiveRecord::Migrationdef upcreate_table :posts do |t|t.string :titlet.text :bodyt.string :slugt.integer :category_idt.timestampsend# … create more tables…add_index :tags, [:name,:something], unique: trueexecute “UPDATE posts SET field = ‘value’ WHERE stuff = ‘happens’”enddef downdrop_table :postsenddef changeadd_column :posts, :user_id, :integerendend$ rake db:migrate](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-25-2048.jpg&f=jpg&w=240)
![Rails: ControllersClass PostsController < ApplicationControllerbefore_filter :authenticate, only: :destroydef index # GET /postsenddef new # GET /posts/newenddef create # POST /postsenddef show # GET /posts/:idenddef edit # GET /posts/:id/editenddef update # PUT /posts/:idenddef destroy # DELETE /posts/:idendend# Routesresources :postsOR limit itresources :posts, only: [:create,:new]](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-26-2048.jpg&f=jpg&w=240)
















![Datatypes: arrays• CREATE TABLE sal_emp(name text, pay_by_quarter integer[],schedule text[][])• CREATE TABLE tictactoe ( squares integer[3][3] )• INSERT INTO tictactoe VALUES (‘{{1,2,3},{4,5,6},{7,8,9}}’)• SELECT squares[1:2][1:1] == {{1},{4}}• SELECT squares[2:3][2:3] == {{5,6},{8,9}}](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-43-2048.jpg&f=jpg&w=240)






![Further exploration: PLV8• CREATE OR REPLACE FUNCTION plv8_test(keys text[], vals text[])RETURNS text AS $$var o = {};for(var i = 0; i < keys.length; i++) {o[keys[i]] = vals[i];}return JSON.stringify(o);$$ LANGUAGE plv8 IMMUTABLE STRICT;SELECT plv8_test(ARRAY[‘name’,’age’],ARRAY[‘Tom’,’29’]);• CREATE TYPE rec AS (i integer, t text);CREATE FUNCTION set_of_records RETURNS SETOF rec AS $$plv8.return_next({“i”: 1,”t”: ”a”});plv8.return_next({“i”: 2,”t”: “b”});$$ LANGUAGE plv8;SELECT * FROM set_of_records();](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fl2bivcp5rpedv7iubhex-140601231607-phpapp01%2f75%2fExploring-Ruby-on-Rails-and-PostgreSQL-50-2048.jpg&f=jpg&w=240)









