Rails and Grails. To get started Make sure you have java installed You can get the sdk and jre at:

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

Lecture plan Information retrieval (from week 11)
The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
Chapter 15 © 2010 by Addison Wesley Longman, Inc Origins and Uses of Ruby - Designed by Yukihiro Matsumoto; released in Use spread rapidly.
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Calendar Browser is a groupware used for booking all kinds of resources within an organization. Calendar Browser is installed on a file server and in a.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Server-Side vs. Client-Side Scripting Languages
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
27-Jun-15 Rails. What is Rails? Rails is a framework for building web applications This involves: Getting information from the user (client), using HTML.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Ruby on Rails Creating a Rails Application Carol E Wolf CS396X.
DR. MOHAMMAD IQBAL THANKS TO ADITYA SENGUPTA Comparing Web Frameworks.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Ruby on Rails: An Introduction JA-SIG Summer Conference 2007 Michael Irion The University of Tulsa.
RUBY ON RAILS Mark Zhang. In this talk  Overview of Ruby on Rails  Core ideas  Show a tiny bit of example code  Touch on several general web development/
RUBY ON RAILS It’s so rad. What we’ll cover  What is Ruby?  What is RoR?  Why RoR?  Developing with RoR  Deployment  Demo  Questions.
Ruby on Rails. What is Ruby on Rails? Ruby on Rails is an open source full-stack web framework. It is an alternative to PHP/MySQL. It can render templates,
Ruby on Rails CSCI 6314 David Gaspar Jennifer Garcia Avila.
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
CSCI 6962: Server-side Design and Programming
1 Dr Alexiei Dingli Web Science Stream Models, Views and Controllers.
UC Berkeley Hello Rails. Review: MVC Goal: separate organization of data (model) from UI & presentation (view) by introducing controller –mediates user.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Using Dreamweaver. Slide 1 Dreamweaver has 2 screens that do different things The Document window where you create your WebPages The Site window where.
Server-side Scripting Powering the webs favourite services.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Pre-Coding Web Design – Sec 3-1 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Web Application Programming Carol Wolf Computer Science.
Chapter 6 The World Wide Web. Web Pages Each page is an interactive multimedia publication It can include: text, graphics, music and videos Pages are.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
FUNCTIONS AND STORED PROCEDURES & FUNCTIONS AND PROTECTING A DB AND PHP (Chapters 9, 15, 18)
An Introduction to Designing and Executing Workflows with Taverna Katy Wolstencroft University of Manchester.
1 Dr Alexiei Dingli Web Science Stream Introducing Rails.
Ruby on Rails Your first app. Rails files app/ Contains the controllers, models, views and assets for your application. You’ll focus on this folder for.
Lecture 11 Rails Topics SaaSSaaS Readings: SaaS book Ch February CSCE 740 Software Engineering.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
Ruby on Rails CSE 190M, Spring 2009 Week 6. Overview How to use a database Demo creating a blog application on Rails Explain how the application works.
The Active Record Paradigm Databases in Database-Centric Web Site Development.
Caching Chapter 12. Caching For high-performance apps Caching: storing frequently-used items in memory –Accessed more quickly Cached Web Form bypasses:
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Ruby on Rails: Databases. Rails Database Familiar Table Concept Naming convention – lower case, plural (i.e. tweets) How to Access (find), Update, Delete.
BIT 285: ( Web) Application Programming Lecture 15: Tuesday, February 24, 2015 Microsoft Azure Instructor: Craig Duckett.
Chapter 15 © 2013 by Pearson Overview of Rails - Rails is a development framework for Web-based applications - Based on MVC architecture for applications.
1 Migration. 2 What’s Migration? Migration –Isolates database differences Allows you to write schema updates without worries about differences –Helps.
WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.
CS 4720 Model-View-Controller CS 4720 – Web & Mobile Systems.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
PHP Form Processing * referenced from
CS 160 and CMPE/SE 131 Software Engineering February 11 Class Meeting Department of Computer Science Department of Computer Engineering San José State.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
IN THIS LESSON WE WILL REVIEW THE STRUCTURE OF THE INTERNET AND HOW BROWSERS ASSEMBLE WEBSITES BASED ON INSTRUCTIONS THEY RECEIVE FROM SERVERS. Internet.
Ruby on Rails. Web Framework for Ruby Designed to make it easier to develop, deploy, and maintain web applications Design with Model-View-Controller –almost.
ASP.NET WEB Applications. ASP.NET  Web application framework developed by Microsoft  Build dynamic data driven web applications and web services  Subset.
1 Rails for the Ruby-Impaired John Paul Ashenfelter CTO/Transitionpoint.
Advanced Migration By Aye Mon Tun.  To change database schema in consistent and easy way  In ruby code Migration? 11/25/2013 2Web Application Engineering.
CGS 3066: Web Programming and Design Spring 2016 Introduction to Server-Side Programming.
Reactor An ORM framework for ColdFusion Presentation By: Doug Hughes
Chapter 12 Introducing Databases. Objectives What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and.
Migrating Wordpress Migrating Wordpress can sometimes get more complicated as it should. There is no plugin that does this for you, the best way is to.
Introduction to Dynamic Web Programming
Ruby Tooling in NetBeans
Content Management System
Haritha Dasari Josue Balandrano Coronel -
PHP / MySQL Introduction
ISC440: Web Programming 2 Server-side Scripting PHP 3
Tutorial 6 PHP & MySQL Li Xu
Review of Previous Lesson
Web Application Development Using PHP
Presentation transcript:

Rails and Grails

To get started Make sure you have java installed You can get the sdk and jre at: java-se-jdk-7-download html java-se-jdk-7-download html Install the jdk and not just the jre

Ruby on Rails Context Website development is highly repetitive The client side has been addressed with a number of tools that support drag and drop, adjustable technology, often xml-based But the rest of the process remained fairly tedius Goal of various web development frameworks Provide a top down approach to building db-centric web apps Remove a lot of configuration detail work Generate the core of the back end code using MVC Hide the db from the developer and provide a more uniform approach, language-wise, for building a web app Tradeoff – programmer loses a lot of control over the architecture of the web app

Install Rails Go to Choose your platform and install the ruby language install “ruby gems” windows, use the installer at Install RubyMine: Go to Settings on RubyMine Tell it where your ruby installation is Install the gem called “bundler” It helps install other gems Run update on all your gems

Create a project Use File to create a new “rails application” in RubyMine Set it up for mysql – RubyMine will do this for you Call it first_project - You should get this:

Your project folder App folder Has your controllers, models, and views in it Remember to save it frequently Config folder Has database.yml file – note that the default is sqlite This is why you had RubyMine use mysql Notice that there are 3 databases in an official RonR app Development, test, production Use development, you don’t need to build the other dbs

Your database Turn on your mysql and apache Create a database called first_project_development No need to create any tables… You may need to put this in your ruby/bin folder: You can get it here – connector-c-noinstall win32.zip/from/pick connector-c-noinstall win32.zip/from/pick

Run your app You should get this:

Click on the blue words and get:

MVC RonR subdirectories The controllers subdirectory. A controller handles a web request from the user. The views subdirectory holds the display templates to fill in with data and return data to the user's browser. The models subdirectory holds the classes that define the data being manipulated The helpers subdirectory holds helper classes used to assist the model, view, and controller classes. The idea is to keep the m, v, and c classes minimal.

Rails tutorial: Assignment 9 Due on Dec 11. See: book?version=3.2 for a very detailed tutorialhttp://ruby.railstutorial.org/ruby-on-rails-tutorial- book?version=3.2 And see: RubyMine-IDE-for-Ruby-on-Rails-Tutorial for instructions on how to use RubyMine for the tutorial RubyMine-IDE-for-Ruby-on-Rails-Tutorial Tutorial assignment: build the demo app described in chapter 2 of the tutorial document: demo-app?version=3.2#tophttp://ruby.railstutorial.org/chapters/a- demo-app?version=3.2#top Hand in a zipped up project folder. I don’t need the database. Include a screen snapshot of your project folder in RubyMine. Important: this material will be on the final. Note: if you have problems with any details of the tutorial you can skip them – the important thing is to learn the concepts and to do most of the tutorial.

Some things to think about as you do the RonR tutorial… What is Active Record? An abstraction layer that sits on top of relational databases Provides an easy way to move between relational platforms Relies on a single.yml file The idea is that you do not write SQL, at least not directly You can retrieve objects: You can add, change, delete tables using “migrations” NOTE: The link to the guides as a whole is: … What do you think of the Active Record paradigm?

Active records This is a form of object to relational mapping Active record connects ruby classes to db tables It is installed with “gem install activerecord”, or via RubyMine See: The classes are the “models” that map to tables “Views” are html pages with embedded ruby “Controllers” are ruby scripts Restrictions (conventions) Class names are singular Table names are plural Tables contain and identity column named id If you use underscores _ in your table name, you leave them out on the class name Active record supports CRUD Create, read, update, delete primitives

More Ruby on Rails questions What are “migrations”? They are a structured and database product Database independent (e.g., MySQL versus Oracle) way of creating and maintaining a database while you build a site Look at: What is Rake? It is a build tool inspired by Make What is “scaffolding”? This is what gives you the framework of an entire website in a snap, making it easy to orient yourself and show something to a customer early on in the website development process You can create basic templates for views, controllers, and models … What do you think of migrations and scaffolding?

Active records primitives create_table change_table drop_table add_column change_column rename_column remove_column add_index remove_index

Important construct: generators These are rails commands that can be used to create pieces of a website Generators often initiate other operations Example $ rails generate scaffold User name:string results in the following generated code: invoke active_record db/migrate/ _create_users.rb create app/models/user.rb invoke test_unit create test/unit/user_test.rb create test/fixtures/users.yml route resources :users

Example continued invoke scaffold_controller create app/controllers/users_controller.rb invoke erb create app/views/users create app/views/users/index.html.erb create app/views/users/edit.html.erb create app/views/users/show.html.erb create app/views/users/new.html.erb create app/views/users/_form.html.erb invoke test_unit create test/functional/users_controller_test.rb invoke helper create app/helpers/users_helper.rb invoke test_unit create test/unit/helpers/users_helper_test.rb invoke stylesheets create app/assets/stylesheets/scaffold.css

Ruby on rails app servers Native ruby webserver: Webrick and needs no configuration, and it is really only a web server (HTTP) Lighttpd is a web server that focuses on speed and low memory usage You can use Apache There is growing use of Phusion:

Installing groovy and grails Go to and install groovyhttp://groovy.codehaus.org/ Make sure to let your OS create a system variable so groovy can be found Go to and download grails, then open it up in one of your user folders (e.g., documents) Open up Intellij Turn on the grails plugin in the plugins settings in File/Settings Create a grails project; you will be asked to point Intellij to your grails folder You will be asked if you are developing an app or a plugin; choose app By default, Grails uses an in memory database called HSQLDB. Hibernate is a widely used object/relational mapping layer that is similar in purpose to Active Record

Grails tutorial: Assignment 10 Due on Dec. 11 You will discover a system of folders has been created, and it looks very much like ruby on rails The datasource.groovy file is where you set up mysql or other database The tutorial to follow is at: lication_with_IntelliJ_IDEA lication_with_IntelliJ_IDEA This is much simpler than the RonR tutorial. Submit: your final grails project, zipped up. I do not need the database. Include a screen snapshot of your Grails project in Intellij. Important: this material will be on the final. …something to think about: how is Grails different from Ruby on Rails?

Extra credit on Grails projecct Get your grails project working with mysql and show it to me! Hint: You need to change the DataSource.groovy code And --- you need to change BuildConfig.groovy code