Ruby%on%Rails% Ruby%on%Rails% %,% 1

Size: px
Start display at page:

Download "Ruby%on%Rails% Ruby%on%Rails% %,% 1"

Transcription

1 Ruby%on%Rails% Ruby%on%Rails% %,% 1

2 / /tonytonyjan tonytonyjan.net Ruby-on-Rails- TJDict-Chrome- Rails-Girls-Taipei-1~5- Ruby%on%Rails% %,% 2

3 Ruby&(Rails) C&(Qt) Java&(Swing) Network&Programming Informa?on&Retrieval Ruby%on%Rails% %,% 3

4 RubyConf*Brazil*2015* Confoo*Canada*2015* Ruby*Kaigi*Japan*2014* Yahoo*Hack*Taiwan*2013* Ruby%on%Rails% %,% 4

5 !RoR! task ' ' => 'Rails' task 'Rails' => %w[ruby CLI RDBMS Git] task ' ' => ' ' Ruby%on%Rails% %,% 5

6 Ruby%on%Rails% %,% 6

7 !gem Ruby%on%Rails% %,% 7

8 User%Story Ruby%on%Rails% %,% 8

9 User%Story%*% Ruby%on%Rails% %,% 9

10 User%Story%*% Ruby%on%Rails% %,% 10

11 Spree ror_ecommerce Piggybak mount 4carrierwave4 Ruby%on%Rails% %,% 11

12 Ruby%on%Rails% %,% 12

13 Ruby%on%Rails% %,% 13

14 "#>"/products "#>"/products/:id "#>"/cart "#>"/orders/new "#>"/orders/:id "#>"/admin/* Ruby%on%Rails% %,% 14

15 git clone cd my_cart rails s Ruby%on%Rails% %,% 15

16 $ bin/rake routes Prefix Verb URI Pattern Controller#Action root GET / products#index product GET /products/:id(.:format) products#show cart GET /cart(.:format) carts#show Ruby%on%Rails% %,% 16

17 # config/routes.rb root 'products#index' resources :products, only: :show resource :cart, only: :show Ruby%on%Rails% %,% 17

18 ERD Ruby%on%Rails% %,% 18

19 ERD Ruby%on%Rails% %,% 19

20 Ruby%on%Rails% %,% 20

21 Ruby%on%Rails% %,% 21

22 Ruby%on%Rails% %,% 22

23 Ruby%on%Rails% %,% 23

24 Ruby%on%Rails% %,% 24

25 Ruby%on%Rails% %,% 25

26 Agile'Web'Development'with'Rails' ror_ecommerce' Spree Piggybak' 'Cart'en>ty 'Order' Ruby%on%Rails% %,% 26

27 rails g model product name description:text price:decimal stock:integer rails g model order name address status payment_method rails g model cart rails g model line_item \ order:references cart:references product:references \ unit_price:decimal quantity:integer Ruby%on%Rails% %,% 27

28 # app/models/cart.rb class Cart has_many :line_items end # app/models/product.rb class Product has_many :line_items end # app/models/order.rb class Order has_many :line_items has_many :products, through: :line_items end Ruby%on%Rails% %,% 28

29 # db/migrate/version_create_line_items.rb t.decimal :unit_price, null: false t.integer :quantity, null: false, default: 1 # db/migrate/version_create_products.rb t.string :name, null: false t.text :description, null: false t.decimal :price, null: false, default: 0 t.integer :stock, null: false # db/migrate/version_create_carts.rb t.string :status, null: false, default: ' ' Ruby%on%Rails% %,% 29

30 rake dev:setup rails g task dev fakeup namespace :dev do desc "Generate fake data" task fakeup: ['db:schema:load', :environment] do 20.times do i Product.create( name: "product no.#{i}", description: "description no.#{i}", price: (rand(10) + 1) * 50, stock: rand(91) + 10 ) end cart = Cart.create Product.all.sample(5).each do product cart.line_items.create product: product, unit_price: product.price, quantity: rand(4) + 1 end end end Ruby%on%Rails% %,% 30

31 Cart#total Cart#empty? Cart#clear Order#total LineItem#subtotal Ruby%on%Rails% %,% 31

32 !controller Prefix Verb URI Pattern Controller#Action root GET / products#index product GET /products/:id(.:format) products#show cart GET /cart(.:format) carts#show rails g controller products index show rails g controller carts show Ruby%on%Rails% %,% 32

33 current_cart class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :set_current_cart, if: ->{ Rails.env.development? } helper_method :current_cart def = Cart.find_or_create_by(id: session[:cart_id]) end private end def set_current_cart session[:cart_id] = 1 end Ruby%on%Rails% %,% 33

34 Ruby%on%Rails% %,% 34

35 Ruby%on%Rails% %,% 35

36 Ruby%on%Rails% %,% 36

37 Rails& Ruby%on%Rails% %,% 37

38 Clean&Architecture&by&Uncle&Bob Ruby%on%Rails% %,% 38

39 !LineItem!!CRUD Ruby%on%Rails% %,% 39

40 # config/routes.rb resources :line_items, only: %i[create update destroy] # app/controllers/line_items_controller.rb class LineItemsController < ApplicationController def = current_cart.line_items.new line_item_params redirect_to cart_path, notice: ' ' render 'products/show' end end private def line_item_params params.require(:line_item).permit(:quantity, :product_id) end end Ruby%on%Rails% %,% 40

41 # app/models/line_item.rb validate :check_stock before_save :set_unit_price def check_stock errors.add(:quantity, 'out of stock') if quantity > product.stock end def set_unit_price self.unit_price = product.price end Ruby%on%Rails% %,% 41

42 # app/controllers/products_controller.rb def = Product.find = end <!-- app/views/products/show.html.erb --> %></h1> <p> %></p> <p> %></p> <p> %></p> <%= do f %> <%= f.number_field :quantity %> <%= f.hidden_field :product_id %> <%= f.submit ' ' %> <% end %> Ruby%on%Rails% %,% 42

43 LineItemsController#destroy LineItemsController#update Ruby%on%Rails% %,% 43

44 Ruby%on%Rails% %,% 44

45 # app/models/cart.rb accepts_nested_attributes_for :line_items validates_associated = { 0 => {quantity: 10, id: 123}, 1 => {quantity: 10, id: 123} } Ruby%on%Rails% %,% 45

46 rails&console cart = Cart.first cart.line_items_attributes = {0 => {quantity: 10, product_id: }} # create cart.line_items_attributes = {0 => {id:, quantity: 10}} # update cart.save Ruby%on%Rails% %,% 46

47 # config/routes.rb resource :cart, only: %i[show update] # app/controllers/carts_controller.rb class CartsController < ApplicationController def update if current_cart.update cart_params redirect_to cart_path, notice: ' ' else render :show end end private def cart_params params.require(:cart).permit(line_items_attributes: [:id, :quantity]) end end Ruby%on%Rails% %,% 47

48 <!-- app/views/carts/show.html.erb --> <%= f.fields_for :line_items do ff %> <% line_item = ff.object %> <tr> <td><%= link_to line_item.product, line_item.product %></td> <td><%= ff.number_field :quantity %></td> <td></td> </tr> <% end %> <input type="number" name="cart[line_items_attributes][1][quantity]"/> <input type="hidden" name="cart[line_items_attributes][1][id]"/> Ruby%on%Rails% %,% 48

49 Ruby%on%Rails% %,% 49

50 RubyConf)Taiwan)2014)!Rails! slides/video Ruby%on%Rails% %,% 50

51 Ruby%on%Rails% %,% 51

52 Ruby%on%Rails% %,% 52

53 # app/models/account.rb class Account < ActiveRecord::Base... end # app/models/admin/account.rb class Admin::Account < Account... def transfer_money(account)... end... end "Account" Admin::Account" "Admin" Admin::Account" "controller" Ruby%on%Rails% %,% 53

54 # href="/posts/:id" form_for(@post) # action="/posts" or "/posts/:id" link_to('foo', # href="/admin/posts/:id" link_to('foo', admin_post_path(@post)) # href="/admin/posts/:id" form_for(@post, url: admin_posts_path) # action="/admin/posts" form_for(@post, url: admin_post_path(@post)) # action="/admin/posts/:id" Ruby%on%Rails% %,% 54

55 # href="/admin/posts/:id" form_for(@post) # action="/admin/posts/:id" or "/admin/posts" Ruby%on%Rails% %,% 55

56 !Post!model 1. #config/routes.rb 2. #app/models/admin/post.rb 3. app/controllers/admin/posts_controller.rb 4. app/views/admin/posts/{index,new,edit}.html.erb Ruby%on%Rails% %,% 56

57 scaffold Ruby%on%Rails% %,% 57

58 !scaffold! rails g scaffold Admin::Product name description:text --parent=product rails g scaffold Admin::Order name address status --parent=order lib templates erb scaffold _form.html.erb edit.html.erb index.html.erb new.html.erb show.html.erb Ruby%on%Rails% %,% 58

59 "lib/templates/erb/scaffold/show.html.erb "table" "bundle show railtie/lib/rails/generators/erb/ scaffold/templates/show.html.erb Product.stock" Ruby%on%Rails% %,% 59

Ruby%on%Rails% Ruby%on%Rails% %,% 1

Ruby%on%Rails% Ruby%on%Rails% %,% 1 Ruby%on%Rails% by#@tonytonyjan Ruby%on%Rails% %,% 1 !layout controller Ruby%on%Rails% %,% 2 !layout controller "applica(on.{js,css} applica(on.html.erb "admin.{js,css} admin.html.erb "admin"namespace"

More information

User Authentication and Session Control

User Authentication and Session Control User Authentication and Session Control CITS3403 Web & Internet Technologies Includes material from Agile Web Development with Rails, 3rd Ed, 2008 and 4 th Ed 2011, 2012 The Pragmatic Programmers. Slides

More information

Rails: Associations and Validation

Rails: Associations and Validation Rails: Associations and Validation Computer Science and Engineering College of Engineering The Ohio State University Lecture 17 Schemas, Migrations, Models migrations models database.yml db:migrate db:create

More information

Rails: Views and Controllers

Rails: Views and Controllers Rails: Views and Controllers Computer Science and Engineering College of Engineering The Ohio State University Lecture 18 Recall: Rails Architecture Wiring Views and Controllers A controller is just an

More information

Getting Started with Rails

Getting Started with Rails Getting Started with Rails January 13, 2015 This guide covers getting up and running with Ruby on Rails. After reading this guide, you will know: How to install Rails, create a new Rails application, and

More information

CSCI-2320 Web Programming: Ruby on Rails

CSCI-2320 Web Programming: Ruby on Rails CSCI-2320 Web Programming: Ruby on Rails Mohammad T. Irfan Plan u Model-View-Controller (MVC) framework of web programming u Ruby on Rails 1 Ruby on Rails u Developed by David Hansson released 2004 u MVC

More information

Web System Development with Ruby on Rails

Web System Development with Ruby on Rails Web System Development with Ruby on Rails Day 11(6/Dec/2012) File uploading and Image Display Today's Theme p Upload image files to the database, and let Memopad store the image file. p Try some other

More information

Migration Methods* Column Options. Active Record Supported Types. Add Column. Remove Column. Create Table. Don t Forget to Rake!

Migration Methods* Column Options. Active Record Supported Types. Add Column. Remove Column. Create Table. Don t Forget to Rake! Migrations To Create a Blank Migration: rails g migration To Add Columns: rails g migration AddTo [columnname:type] To Remove Columns: rails g migration RemoveFrom

More information

Rails 4 Quickly. Bala Paranj

Rails 4 Quickly. Bala Paranj Rails 4 Quickly Bala Paranj 1 About Author Bala Paranj has a Master s degree in Electrical Engineering from The Wichita State University. He has over 15 years of experience in the software industry. He

More information

Ruby on Rails 3. Robert Crida Stuart Corbishley. Clue Technologies

Ruby on Rails 3. Robert Crida Stuart Corbishley. Clue Technologies Ruby on Rails 3 Robert Crida Stuart Corbishley Clue Technologies Topic Overview What is Rails New in Rails 3 New Project Generators MVC Active Record UJS RVM Bundler Migrations Factory Girl RSpec haml

More information

Ruby on Rails Installation

Ruby on Rails Installation Ruby on Rails Installation http://www.tutorialspoint.com/ruby-on-rails/rails-installation.htm This tutorial will guide you to set up a private Ruby on Rails environment in the daw server. Step 0: Login

More information

Application Development in Web Mapping 6.

Application Development in Web Mapping 6. Application Development in Web Mapping 6. László Kottyán Application Development in Web Mapping 6.: Web Application Framework László Kottyán Lector: Antal Guszlev This module was created within TÁMOP -

More information

COM401 Software Engineering Laboratory

COM401 Software Engineering Laboratory Computer Engineering Department COM401 Software Engineering Laboratory November 04, 2014 LAB-3: Rails Introduction Time: 2 lab hours Objectives: Practice with Ruby Symbols Routes MVC pattern CRUD operations

More information

Lecture 9. Forms & APIs 1 / 38

Lecture 9. Forms & APIs 1 / 38 Lecture 9 Forms & APIs 1 / 38 Final Project Proposal Due November 12th 11:59PM Should include: A summary of your idea A diagram with the db tables you plan to use& the relationships between them You can

More information

Rails: MVC in action

Rails: MVC in action Ruby on Rails Basic Facts 1. Rails is a web application framework built upon, and written in, the Ruby programming language. 2. Open source 3. Easy to learn; difficult to master. 4. Fun (and a time-saver)!

More information

Application Development in Web Mapping 6.

Application Development in Web Mapping 6. University of West Hungary, Faculty of Geoinformatics László Kottyán Application Development in Web Mapping 6. module ADW6 Web Application Framework SZÉKESFEHÉRVÁR 2010 The right to this intellectual property

More information

Lecture 4. Ruby on Rails 1 / 49

Lecture 4. Ruby on Rails 1 / 49 Lecture 4 Ruby on Rails 1 / 49 Client-Server Model 2 / 49 What is it? A client (e.g. web browser, phone, computer, etc.) sends a request to a server Request is an HTTP request Stands for HyperText Transfer

More information

Building a Rails Application

Building a Rails Application Building a Rails Application Let s get started! Use MySQL to create a depot_development database Create a new Ruby on Rails project called depot Make sure root password is included in Configuration/database.yml

More information

Model-View-Controller (MVC)

Model-View-Controller (MVC) Model-View-Controller (MVC) with Ruby on Rails Software Languages Team University of Koblenz-Landau Ralf Lämmel and Andrei Varanovich MVC - a classic definition The Model is the application object The

More information

Migrations (Chapter 23)

Migrations (Chapter 23) Migrations (Chapter 23) The notes in this document are based on the online guide at http://guides.rubyonrails.org/migrations.html and the Agile Web Development with Rails, 4 th edition, book. Migration

More information

Rails 5 Quickly. Bala Paranj

Rails 5 Quickly. Bala Paranj Rails 5 Quickly Bala Paranj 1 About the Author Bala Paranj has a masters degree in Electrical Engineering from The Wichita State University. He has been working in the software industry since 1996. He

More information

Mastering Modern Payments

Mastering Modern Payments Mastering Modern Payments Using Stripe with Rails by Pete Keen Sample Chapter State and History So far in our little example app we can buy and sell downloadable products using Stripe. We're not keeping

More information

Layouts and Rendering in Rails

Layouts and Rendering in Rails Layouts and Rering in Rails January 13, 2015 This guide covers the basic layout features of Action Controller and Action View. After reading this guide, you will know: How to use the various rering methods

More information

Rails: Associations and Validation

Rails: Associations and Validation Rails: Associations and Validation Computer Science and Engineering College of Engineering The Ohio State University Lecture 26 Schemas, Migrations, Models migrations models database.yml db:migrate db:create

More information

Rails Guide. MVC Architecture. Migrations. Hey, thanks a lot for picking up this guide!

Rails Guide. MVC Architecture. Migrations. Hey, thanks a lot for picking up this guide! Rails Guide Hey, thanks a lot for picking up this guide! I created this guide as a quick reference for when you are working on your projects, so you can quickly find what you need & keep going. Hope it

More information

Day 3: 26/April/2012 Scaffolding Generation of Skeletons; Test run Memopad

Day 3: 26/April/2012 Scaffolding Generation of Skeletons; Test run Memopad Day 3: 26/April/2012 Scaffolding Generation of Skeletons; Test run Memopad p Generate WEB screens of the MemoPad Database Application n Setting up for Database Connection n Automatic generation of DB Files

More information

Building a Rails Application. Part 2

Building a Rails Application. Part 2 Building a Rails Application Part 2 app/views/layouts/store.rhtml

More information

What's new in Rails 4. Lucas Caton

What's new in Rails 4. Lucas Caton What's new in Rails 4 Lucas Caton www.lucascaton.com.br 4 June 25, 2013 Rails 4.0: Final version released! Ruby 1.8.7 Ruby 1.9.2 Ruby 1.9.3 Ruby 2.0.0 RubyGems 2.x ThreadSafety memcache-client dalli =>

More information

Table of Contents EVALUATION COPY

Table of Contents EVALUATION COPY Table of Contents What is Ruby on Rails?... 1-2 Overview of Rails Components... 1-3 Installing Rails... 1-5 A Simple Rails Application... 1-6 Starting the Rails Server... 1-8 Static Pages Within a Rails

More information

appendix B: Working with Ruby on Rails

appendix B: Working with Ruby on Rails B1 appix B: Working with Ruby on Rails APPENDIX B B2 Since the beginning of the Web, both static and dynamic typed languages have been used for writing web applications. Java and its cousin C# have emerged

More information

Episode 298. Getting Started With Spree

Episode 298. Getting Started With Spree Episode 298 Getting Started With Spree Spree 1 is a fully-featured e-commerce solution that can be easily integrated into a Rails application. If you need to turn a Rails app into a store that sells products

More information

Lecture 8. Validations & Sessions 1 / 41

Lecture 8. Validations & Sessions 1 / 41 Lecture 8 Validations & Sessions 1 / 41 Advanced Active Record 2 / 41 More Complex Queries Arel provides us with a number of methods to query our database tables So far, we've only used find which limits

More information

Lecture 4. Ruby on Rails 1 / 52

Lecture 4. Ruby on Rails 1 / 52 Lecture 4 Ruby on Rails 1 / 52 Homeworks 2 & 3 Grades were released for homework 2 Homework 3 was due last night Everyone got a style freebie since my default setup ignores spec files and I didn't change

More information

JRuby Rails Web Application Development

JRuby Rails Web Application Development SPRINGER BRIEFS IN COMPUTER SCIENCE Deepak Vohra JRuby Rails Web Application Development 123 SpringerBriefs in Computer Science Series Editors Stan Zdonik Peng Ning Shashi Shekhar Jonathan Katz Xindong

More information

Advanced Rails Recipes

Advanced Rails Recipes Advanced Rails Recipes Mike Clark and the Rails Community The Pragmatic Bookshelf Raleigh, North Carolina Dallas, Texas Many of the designations used by manufacturers and sellers to distinguish their products

More information

Object Relational Mapping. Kenneth M. Anderson University of Colorado, Boulder Lecture 29 CSCI 4448/ /06/11

Object Relational Mapping. Kenneth M. Anderson University of Colorado, Boulder Lecture 29 CSCI 4448/ /06/11 Object Relational Mapping Kenneth M. Anderson University of Colorado, Boulder Lecture 29 CSCI 4448/5448 12/06/11 1 Credit where Credit is Due The slides that cover Hibernate and JPA were developed by Aaron

More information

Introduction to Ruby on Rails

Introduction to Ruby on Rails Introduction to Ruby on Rails Ralf Teusner ralf.teusner@hpi.de Software Engineering II WS 2018/19 Prof. Plattner, Dr. Uflacker Enterprise Platform and Integration Concepts group Introduction to Ruby on

More information

Thanks for downloading this sample chapter of Keep Your Ruby on Rails App Healthy!

Thanks for downloading this sample chapter of Keep Your Ruby on Rails App Healthy! Thank You Thanks for downloading this sample chapter of Keep Your Ruby on Rails App Healthy! The premium edition of the Keep Your Ruby on Rails App Healthy of is a complete rewrite of the original course.

More information

Here are some figures to consider while answering the following questions.

Here are some figures to consider while answering the following questions. Here are some figures to consider while answering the following questions. Figure 1. Example page from Music Catalog web app. Figure 2. config/routes.rb Figure 3. Output of rake routes command. Figure

More information

Introduction to Ruby on Rails

Introduction to Ruby on Rails Introduction to Ruby on Rails Software Engineering II WS 2016/17 Arian Treffer arian.treffer@hpi.de Prof. Plattner, Dr. Uflacker Enterprise Platform and Integration Concepts group Introduction to Ruby

More information

Hello, world! 3.1. Ruby on Rails Web SimpleGreeter Hello, world! Rails SimpleGreeter Web Rails projects. ruby $ mkdir -p ~/projects

Hello, world! 3.1. Ruby on Rails Web SimpleGreeter Hello, world! Rails SimpleGreeter Web Rails projects. ruby $ mkdir -p ~/projects 3 Hello, world! Ruby on Rails Web SimpleGreeter Hello, world! 3.1 Rails SimpleGreeter Web Rails projects OIAX BOOKS Ruby on Rails 5.0 $ mkdir -p ~/projects ruby 2.3.1 15 3 Hello, world! $ cd ~/projects

More information

Introduction to Ruby on Rails

Introduction to Ruby on Rails Introduction to Ruby on Rails Keven Richly keven.richly@hpi.de Software Engineering II WS 2017/18 Prof. Plattner, Dr. Uflacker Enterprise Platform and Integration Concepts group Introduction to Ruby on

More information

SportsStore: Administration

SportsStore: Administration C H A P T E R 11 SportsStore: Administration In this chapter, I continue to build the SportsStore application in order to give the site administrator a way of managing orders and products. Managing Orders

More information

Web System Development with Ruby on Rails

Web System Development with Ruby on Rails Web System Development with Ruby on Rails Day 7(8/Nov/2012) Relational Database Today's Theme Learn Relation Structure in Relational Database Understand how to describe the relational structure Add new

More information

Typical PHP Code Everything shoved into one file. Not Good!

Typical PHP Code Everything shoved into one file. Not Good! MVC in Trax Typical PHP Code Everything shoved into one file. Not Good!

More information

This allows us to use the cookbook code that was downloaded with InstantRails, instead of a new copy of that code. Why is this important?

This allows us to use the cookbook code that was downloaded with InstantRails, instead of a new copy of that code. Why is this important? The Cookbook Application, cont. To bring up the Cookbook application, create a new Ruby project (rightclick in Package Explorer view, then New Project. We name the project cookbook and then deselect the

More information

Ruby Gem Internals by Examples

Ruby Gem Internals by Examples SF Software Design in Ruby Meetup Group Ruby Gem Internals by Examples Ben Zhang, 1/14/2014 benzhangpro@gmail.com http://www.meetup.com/software-design-in-ruby-study-group/ Types of Ruby Gem Features Global

More information

Ruby on Rails. Brian McCallister Ning, Inc. Philadelphia Emerging Technology Conference 06

Ruby on Rails. Brian McCallister Ning, Inc. Philadelphia Emerging Technology Conference 06 Ruby on Rails Brian McCallister Ning, Inc. Philadelphia Emerging Technology Conference 06 Smalltalk Robert Tinney www.tinney.net + Lisp Conrad Barski www.lisperati.com + Perl O Reilly www.perl.com Without

More information

Cheap, Fast, and Good You can have it all with Ruby on Rails

Cheap, Fast, and Good You can have it all with Ruby on Rails Cheap, Fast, and Good You can have it all with Ruby on Rails Brian McCallister brianm@ninginc.com http://www.ning.com/ What is Ruby? Dynamic and Interpreted Strong support for OO programming Everything

More information

Ruby on Rails 3.2 Release Notes

Ruby on Rails 3.2 Release Notes Ruby on Rails 3.2 Release Notes January 13, 2015 Highlights in Rails 3.2: Faster Development Mode New Routing Engine Automatic Query Explains Tagged Logging These release notes cover only the major changes.

More information

Contents in Detail. Foreword by Xavier Noria

Contents in Detail. Foreword by Xavier Noria Contents in Detail Foreword by Xavier Noria Acknowledgments xv xvii Introduction xix Who This Book Is For................................................ xx Overview...xx Installation.... xxi Ruby, Rails,

More information

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy AngularJS CRUD Application example with AngularJS and Rails 4 1 Slides By: Jonathan McCarthy Create a new Rails App For this example we will create an application to store student details. Create a new

More information

Rails Routing Roundup

Rails Routing Roundup Rails Routing Roundup Rails Routing Roundup David A. Black Ruby Power and Light, LLC http://www.rubypal.com 1 Roadmap Basics of routing system Recognition Generation Defining routes (routing rules) in

More information

Multitenancy with Rails

Multitenancy with Rails Multitenancy with Rails And subscriptions too! Ryan Bigg This book is for sale at http://leanpub.com/multi-tenancy-rails This version was published on 2015-11-24 This is a Leanpub book. Leanpub empowers

More information

Day 8: 7/June/2012. Log-in Authentication

Day 8: 7/June/2012. Log-in Authentication Day 8: 7/June/2012 Log-in Authentication p Learn authentication so that only specific users can use the Web information of the system. p We use Devise to p Add one line to the file project/gemfile gem

More information

Rails: Associations and Validation

Rails: Associations and Validation Rails: Associations and Validation Computer Science and Engineering College of Engineering The Ohio State University Lecture 28 Schemas, Migrations, Models migrations models database.yml db:migrate db:create

More information

Introduction and first application. Luigi De Russis. Rails 101

Introduction and first application. Luigi De Russis. Rails 101 Introduction and first application Luigi De Russis 2 About Rails Ruby on Rails 3 Framework for making dynamic web applications created in 2003 Open Source (MIT License) for the Ruby programming language

More information

School of Computer Science and Software Engineering 2ND SEMESTER EXAMINATIONS CITS4230 Internet Technologies

School of Computer Science and Software Engineering 2ND SEMESTER EXAMINATIONS CITS4230 Internet Technologies School of Computer Science and Software Engineering 2ND SEMESTER EXAMINATIONS 2012 Internet Technologies FAMILY NAME: GIVEN NAMES: STUDENT ID: SIGNATURE: This paper contains: 16 pages (including the title

More information

Ruby on Rails 3.1 Release Notes

Ruby on Rails 3.1 Release Notes Ruby on Rails 3.1 Release Notes December 25, 2014 Highlights in Rails 3.1: Streaming Reversible Migrations Assets Pipeline jquery as the default JavaScript library These release notes cover only the major

More information

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy AngularJS CRUD Application example with AngularJS and Rails 4 1 Slides By: Jonathan McCarthy Create a new Rails App For this example we will create an application to store student details. Create a new

More information

Contributing to Insoshi with Git and GitHub. Michael Hartl

Contributing to Insoshi with Git and GitHub. Michael Hartl Contributing to Insoshi with Git and GitHub Michael Hartl + Winter 08 + Winter 08 + = Winter 08 Open-source social networking platform dogfood.insoshi.com #1 #1 #2 Common Contacts class Person

More information

Associations: mechanics (ESaaS 5.3)"

Associations: mechanics (ESaaS 5.3) Associations: mechanics (ESaaS 5.3)" Armando Fox" 2013 Armando Fox & David Patterson, all rights reserved How does it work?" Models must have attribute for foreign key of owning object" e.g., movie_id

More information

Rails: Models. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 25

Rails: Models. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 25 Rails: Models Computer Science and Engineering College of Engineering The Ohio State University Lecture 25 Recall: Rails Architecture Recall: Rails Architecture Mapping Tables to Objects General strategy

More information

Multitenancy with Rails - 2nd edition

Multitenancy with Rails - 2nd edition Multitenancy with Rails - 2nd edition Ryan Bigg This book is for sale at http://leanpub.com/multi-tenancy-rails-2 This version was published on 2018-04-13 This is a Leanpub book. Leanpub empowers authors

More information

Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails

Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails Agenda 2 Ruby & Ruby on Rails What is Ruby on Rails? A few words about Ruby Rails core components RESTful architecture Your first

More information

DRYing Out MVC (ESaaS 5.1)"

DRYing Out MVC (ESaaS 5.1) DRYing Out MVC (ESaaS 5.1)" Armando Fox" 2013 Armando Fox & David Patterson, all rights reserved Don t Repeat Yourself but how?" Goal: enforce that movie names must be less than 40 characters" Call a check

More information

Lecture 7. Action View, Bootstrap & Deploying 1 / 40

Lecture 7. Action View, Bootstrap & Deploying 1 / 40 Lecture 7 Action View, Bootstrap & Deploying 1 / 40 Homeworks 5 & 6 Homework 5 was graded Homework 6 was due last night Any questions? 2 / 40 How would you rate the di culty of Homework 6? Vote at http://pollev.com/cis196776

More information

Choose Your Battles and LetIt::REST. Hampton Catlin and Jeffrey Hardy

Choose Your Battles and LetIt::REST. Hampton Catlin and Jeffrey Hardy Choose Your Battles and LetIt::REST Hampton Catlin and Jeffrey Hardy Obligatory Resume 50 years of Rails experience PHDs from MIT Founded the Dharma Initiative Invented Haml, Scribbish, Sass, ASCII, Ruby,

More information

Session 5 Software Development with Ruby on Rails

Session 5 Software Development with Ruby on Rails Quintessential School Systems Session 5 Software Development with Ruby on Rails Presented by Mark Bixby Jeff Vance Copyright Quintessential School Systems, 2009 All Rights Reserved 867 American Street

More information

CS169.1x Lecture 6: Basic Rails" Fall 2012"

CS169.1x Lecture 6: Basic Rails Fall 2012 CS169.1x Lecture 6: Basic Rails" Fall 2012" 1" The Database is Golden Contains valuable customer data don t want to test your app on that! Rails solution: development, production and test environments

More information

CSE 135. Main Problem: Multiple languages and multiple computation servers

CSE 135. Main Problem: Multiple languages and multiple computation servers CSE 15 Rapid Application Development: Object-Relational Mapping & a lesson on the whys and why nots Main Problem: Multiple languages and multiple computation servers Two different computation servers with

More information

IN ACTION. Ryan Bigg Yehuda Katz Steve Klabnik Rebecca Skinner SAMPLE CHAPTER MANNING

IN ACTION. Ryan Bigg Yehuda Katz Steve Klabnik Rebecca Skinner SAMPLE CHAPTER MANNING IN ACTION Ryan Bigg Yehuda Katz Steve Klabnik Rebecca Skinner SAMPLE CHAPTER MANNING Rails 4 in Action by Ryan Bigg Yehuda Katz Steve Klabnik and Rebecca Skinner Chapter 3 Copyright 2015 Manning Publications

More information

A database-driven web site

A database-driven web site Chapter 20 A database-driven web site The HTML that s generated by the system the Fender Stratocaster is the electric guitar design that changed the world. This guitar features a thicker bridge

More information

Courslets, a golf improvement web service. Peter Battaglia

Courslets, a golf improvement web service. Peter Battaglia Courslets, a golf improvement web service Peter Battaglia Discussion Project Overview Design and Technologies Utilized Rails and REST URLs, URLs, URLs Rails and Web Services What s s exposed as a service?

More information

ChiliProject - Bug # 529: builder is not part of the bundle. Add it to Gemfile

ChiliProject - Bug # 529: builder is not part of the bundle. Add it to Gemfile ChiliProject - Bug # 529: builder is not part of the bundle. Add it to Gemfile Status: Closed Priority: Normal Author: Enno Grà per Category: Created: 2011-07-17 Assignee: Updated: 2012-06-23 Due date:

More information

Sergio Benitez.

Sergio Benitez. Sergio Benitez sb@sergio.bz Rocket is a web framework for Rust that makes it simple to write fast web applications without sacrificing flexibility or type safety. Rocket is a web framework for Rust that

More information

Ruby on Rails. Rails Released 1.0 Yesterday! Brian McCallister. ApacheCon US 2005

Ruby on Rails. Rails Released 1.0 Yesterday! Brian McCallister. ApacheCon US 2005 Ruby on Rails Rails Released 1.0 Yesterday! Brian McCallister ApacheCon US 2005 Smalltalk Robert Tinney www.tinney.net + Lisp Conrad Barski www.lisperati.com + Perl O Reilly www.perl.com Without the...

More information

HIDE PRICE CALL FOR PRICE FOR MAGENTO 2

HIDE PRICE CALL FOR PRICE FOR MAGENTO 2 1 User Guide Hide Price Call For Price for Magento 2 HIDE PRICE CALL FOR PRICE FOR MAGENTO 2 USER GUIDE BSS COMMERCE 1 2 User Guide Hide Price Call For Price for Magento 2 Contents 1. Hide Price Call For

More information

ConJobs: Part 1 - Program your receipt printer

ConJobs: Part 1 - Program your receipt printer ConJobs: Part 1 - Program your receipt printer Step 1: Prepare thermal printer Cut wires and connect the power to the printer. Screw the wires down from the power adapter. Check that the green light flashes,

More information

Index. Numbers and Symbols. 404.html file, html file, html file, 24. store, 186

Index. Numbers and Symbols. 404.html file, html file, html file, 24. store, 186 Index Numbers and Symbols 404.html file, 24 422.html file, 24 500.html file, 24 && (and) operator, 9 10 @, for instance variables, 15 \ (backslash), for special characters, 6 : (colon), for symbols, 7

More information

COPYRIGHTED MATERIAL. Building Resources. A Good Place to Start

COPYRIGHTED MATERIAL. Building Resources. A Good Place to Start Building Resources Ruby on Rails is opinionated software. This doesn t mean that it s going to make fun of your haircut, or tell you what kind of car to drive. It does mean that Rails has definite ideas

More information

Demystifying Rails Plugin Development

Demystifying Rails Plugin Development Demystifying Rails Plugin Development Nick Plante :: Voices That Matter Professional Ruby Conference November 18th, 2008 Obligatory Introduction Plugins are generalized, reusable code libraries Ext or

More information

Authentication in Rails

Authentication in Rails Authentication in Rails Aaron Mulder CTO Chariot Solutions Philly on Rails, October 2007 1 Agenda The problem Plugins in Rails, and the (many) solutions acts_as_authenticated Generated Code Custom Code

More information

Lab 5: Web Application Test Automation

Lab 5: Web Application Test Automation Software Testing MTAT.03.159 Lab 5: Web Application Test Automation Inst. of Comp. Science, University of Tartu Spring 2018 Instructions Submission deadline: Lab reports must be submitted within seven

More information

iflame INSTITUTE OF TECHNOLOGY

iflame INSTITUTE OF TECHNOLOGY Web Development Ruby On Rails Duration: 3.5 Month Course Overview Ruby On Rails 4.0 Training From Iflame Allows You To Build Full Featured, High Quality, Object Oriented Web Apps. Ruby On Rails Is A Full

More information

6.170 Tutorial 7 - Rails Security. Prerequisites. Goals of this tutorial. Resources

6.170 Tutorial 7 - Rails Security. Prerequisites. Goals of this tutorial. Resources 6.170 Tutorial 7 - Rails Security Introduction Sessions Session Hijacking Replay Attacks Session Fixation CSRF Hackers Love Mass Assignment Injection SQL Injection Cross Site Scripting (XSS) Logging Authorizing

More information

How to use the MVC pattern to organize your code

How to use the MVC pattern to organize your code Chapter 5 How to use the MVC pattern to organize your code The MVC pattern 2017, Mike Murach & Associates, Inc. C5, Slide 1 2017, Mike Murach & Associates, Inc. C5, Slide 4 Objectives Applied 1. Use the

More information

Typus Documentation. Release beta. Francesc Esplugas

Typus Documentation. Release beta. Francesc Esplugas Typus Documentation Release 4.0.0.beta Francesc Esplugas November 20, 2014 Contents 1 Key Features 3 2 Support 5 3 Installation 7 4 Configuration 9 4.1 Initializers................................................

More information

Lecture 6. Active Record Associations 1 / 30

Lecture 6. Active Record Associations 1 / 30 Lecture 6 Active Record Associations 1 / 30 Homeworks 4 & 5 Homework 4 was graded Homework 5 was due last night Any questions? 2 / 30 Learn HTML Time's almost up! You're going to be writing your own views

More information

Learn Ruby on Rails. Learn Web Development With Ruby on Rails

Learn Ruby on Rails. Learn Web Development With Ruby on Rails Learn Ruby on Rails Learn Web Development With Ruby on Rails Who am I? I am Harry and just like you I had never done any coding before. A complete beginner I wanted to learn how to create web apps such

More information

I dreamed a thousand new paths... I woke and walked my old one. Chinese proverb

I dreamed a thousand new paths... I woke and walked my old one. Chinese proverb CHAPTER 3 Routing I dreamed a thousand new paths... I woke and walked my old one. Chinese proverb The routing system in Rails is the system that examines the URL of an incoming request and determines what

More information

Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails

Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails Agenda 2 Ruby & Ruby on Rails What is Ruby on Rails? A few words about Ruby Rails core components RESTful architecture Your first

More information

Sign up. Chapter Signup form

Sign up. Chapter Signup form Chapter 8 Sign up Now that we have a working User model, it s time to add an ability few websites can live with out: letting users sign up for the site thus fulfilling the promise implicit in Section 53,

More information

Active Record Associations

Active Record Associations Active Record Associations January 13, 2015 This guide covers the association features of Active Record. After reading this guide, you will know: How to declare associations between Active Record models.

More information

CSC 405 Computer Security. Web Security

CSC 405 Computer Security. Web Security CSC 405 Computer Security Web Security Alexandros Kapravelos akaprav@ncsu.edu (Derived from slides by Giovanni Vigna and Adam Doupe) 1 The XMLHttpRequest Object Microsoft developers working on Outlook

More information

Advanced RESTful Rails. Ben Scofield

Advanced RESTful Rails. Ben Scofield Advanced RESTful Rails Ben Scofield Constraints Shall I compare thee to a summer's day? Thou art more lovely and more temperate. Rough winds do shake the darling buds of May, And summer's lease hath all

More information

Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails

Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails Agenda 2 Ruby & Ruby on Rails What is Ruby on Rails? A few words about Ruby Core components RESTful architecture Active Record Your

More information

Django-CSP Documentation

Django-CSP Documentation Django-CSP Documentation Release 3.0 James Socol, Mozilla September 06, 2016 Contents 1 Installing django-csp 3 2 Configuring django-csp 5 2.1 Policy Settings..............................................

More information

Domain-Driven Rails Redux. Pat Maddox RailsConf 2010

Domain-Driven Rails Redux. Pat Maddox RailsConf 2010 Domain-Driven Rails Redux Pat Maddox RailsConf 2010 A Short Story Software is a learning process Design matters Complexity inherent in the system All complexity not created equal I need to do because the

More information

Oracle EXAM - 1Z Oracle Database SQL Expert. Buy Full Product.

Oracle EXAM - 1Z Oracle Database SQL Expert. Buy Full Product. Oracle EXAM - 1Z0-047 Oracle Database SQL Expert Buy Full Product http://www.examskey.com/1z0-047.html Examskey Oracle 1Z0-047 exam demo product is here for you to test the quality of the product. This

More information