Ruby on Rails Framework and Tools Description
Total Page:16
File Type:pdf, Size:1020Kb
Dimitar Zlatkov Development of Web Community Application with Ruby on Rails framework Bachelor Thesis based on the examination and study regulations for the Bachelor of Engineering degree programme Information Engineering at the Department of Information and Electrical Engineering of the Faculty of Engineering and Computer Science of the University of Applied Sciences Hamburg Supervising examiner: Prof. Dr. Hans-Jürgen Hotop Second examiner: Prof. Dr. Dieter Müller-Wichards Day of delivery May 28th 2009 Dimitar Zlatkov 1 Dimitar Zlatkov Title of the Bachelor Thesis Development of Web Community Application with Ruby on Rails framework Keywords Ruby, Ruby on Rails, Web Application, Community, Internet, WWW, MVC Framework, HTML, MySQL, Mongrel Abstract This thesis discusses the development steps of a web-based community application that enables a user to log-in, communicate and interact with other users in a browser based environment. It describes in detail the implementation of an application front-end and back-end. The thesis has formulated and defined an approach to develop such a web application using the Ruby on Rails technology. Dimitar Zlatkov Thema der Bachelorarbeit Entwicklung von Web-Community-Applikation mit Ruby on Rails Framework Stichworte Ruby, Ruby on Rails, Web Application, Community, Internet, WWW, MVC Framework, HTML, MySQL, Mongrel Kurzzusammenfassung Diese Arbeit beschäftigt sich mit der Entwicklung einer web-basierten Community Platform, die es eingeloggten Benutzern erlaubt, in einer Browser- basierten Umgebung, miteinander zu interagieren. Es beschreibt detailliert die Implementation von Front- und Back-End einer Anwendung mit Hilfe der Ruby-on-Rails-Technologie. Dimitar Zlatkov 2 Table of Contents List of Figures................................................................................................................4 Chapter 1 – Introduction................................................................................................5 1.1 The Problem........................................................................................................5 1.2 The Web Community Application Overview........................................................6 1.3 The Scope of this Report....................................................................................7 1.4 The Structure of this Report................................................................................8 Chapter 2 - Software Tools Overview...........................................................................9 Chapter 3 - Project Analysis and Requirements.........................................................16 3.1 Project Analysis.................................................................................................16 3.2 Project Functional Requirements......................................................................17 3.3 Project Software Requirements........................................................................19 3.4 Project Hardware Requirements.......................................................................22 Chapter 4 - Project Design..........................................................................................25 4.1 Web Application Three-Tier Model...................................................................25 4.2 Web Community Application Architecture.........................................................26 4.3 Overview of the Application MVC Architecture.................................................28 4.4 Implementation of the Application MVC Architecture.......................................29 4.4.1 The View Layer..........................................................................................29 4.4.2 The Model Layer........................................................................................32 4.4.3 The Controller Layer..................................................................................34 4.5 Back-end - Database Design............................................................................37 Chapter 5 – System Realization..................................................................................43 5.1 Realization of Log-in ........................................................................................43 5.2 Realization of User Profile.................................................................................45 5.3 Realization of Social Network...........................................................................48 5.4 Realization of Messaging System.....................................................................50 5.5 Realization of Comments System.....................................................................54 5.6 Realization of Administrator User.....................................................................55 5.7 Realization of Navigation Bar and Search Engine............................................59 5.8 Integrating Google Maps...................................................................................62 Chapter 6 – Testing and Further Development...........................................................65 6.1 Automated Tests...............................................................................................65 6.2 Usability Tests...................................................................................................68 6.3 Further work......................................................................................................71 Chapter 7 – Conclusion...............................................................................................73 Appendix A - References.............................................................................................75 Appendix B - Glossary ................................................................................................76 Appendix C - Source Code Listing .............................................................................78 Declaration ..................................................................................................................79 Dimitar Zlatkov 3 List of Figures Fig. 2.1 The Model View Controller architecture [7]....................................................10 Fig. 2.2 Architecture of standard Ruby on Rails web application [8]..........................12 Fig. 3.1 Overview of the Spring Framework [12].........................................................21 Fig. 3.2 Mongrel Cluster architecture using Apache 2.2 as load balancer [11]..........23 Fig. 4.1 Visual overview of a Three-tiered Web Application.......................................25 Fig. 4.2 High-level view of the Web Community application.......................................26 Fig. 4.3 Use case diagram of the Web Community application..................................27 Fig. 4.4 Model-View-Controller Architecture of the Web Community application.......28 Fig. 4.5 Web Community application logged-in layout template view.........................30 Fig. 4.6 Web Community application not logged-in layout template view...................31 Fig. 4.7 Model layer class diagram of the Web Community Application.....................32 Fig. 4.8 Routes table of the Web Community application...........................................35 Fig. 4.9 Database design model of the Web Community application.........................42 Fig. 5.1 Start page of the Web Community application...............................................43 Fig. 5.2 Profile page of the Web Community application............................................45 Fig. 5.3 Edit profile page of the Web Community application.....................................46 Fig. 5.4 Edit album page of the Web Community application.....................................47 Fig. 5.5 Friends index page of the Web Community application................................49 Fig. 5.6 Sent new page of the Web Community application......................................51 Fig. 5.7 Sent page of the Web Community application...............................................52 Fig. 5.8 Inbox page of the Web Community application.............................................53 Fig. 5.9 Show message page of Web Community application....................................54 Fig. 5.10 Comments partial page of the Web Community application........................55 Fig. 5.11 Administrator user page of the Web Community application.......................56 Fig. 5.12 State diagram of User model in the Web Community application...............57 Fig. 5.13 New user page of the Web Community application.....................................58 Fig. 5.14 Navigation bar of the Web Community application......................................59 Fig. 5.15 Home page of the Web Community application...........................................60 Fig. 5.16 Map page of the Web Community application.............................................62 Fig. 5.17 Add photo location form...............................................................................63 Fig. 5.18 Show map page with photo markers............................................................64 Fig. 6.1 Run all unit tests for User model....................................................................65 Fig. 6.2 Running sessions controller functional tests..................................................68 Fig. 6.3 User opens the start page and tries to log-in.................................................69 Fig. 6.4 User is asked to enter correct email/password combination.........................69 Fig.