Chapter 4.1 – Deeper into Rails Maciej Mensfeld Presented by: Maciej Mensfeld Deeper into Rails mensfeld.pl github.com/mensfeld senior.

Slides:



Advertisements
Similar presentations
REST Introduction 吴海生 博克软件(杭州)有限公司.
Advertisements

DOCUMENT TYPES. Digital Documents Converting documents to an electronic format will preserve those documents, but how would such a process be organized?
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
Location Tracker Maciej Mensfeld Presented by: Maciej Mensfeld Location Tracker dev.mensfeld.pl github.com/mensfeld.
Building RESTful Interfaces
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
Ruby on Rails Model of MVC. Model-View-Controller Paradigm A way of organizing a software system Benefits: Isolation of business logic from the user interface.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Chapter User authorization & safety Maciej Mensfeld Presented by: Maciej Mensfeld User authorization & safety dev.mensfeld.pl.
Ruby: An introduction - Who am I? Maciej Mensfeld Presented by: Maciej Mensfeld Ruby: An introduction dev.mensfeld.pl github.com/mensfeld.
Chapter 2 Data Models Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
ASP.NET Programming with C# and SQL Server First Edition
Introduction to XML This material is based heavily on the tutorial by the same name at
Web Services Michael Smith Alex Feldman. What is a Web Service? A Web service is a message-oriented software system designed to support inter-operable.
UNIT-V The MVC architecture and Struts Framework.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
Web server and web browser It’s a take and give policy in between client and server through HTTP(Hyper Text Transport Protocol) Server takes a request.
Separating VUI from business logic Caller Experience-centered design approach Alex Kurganov, CTO Parus Interactive
Chapter 3.1 – RoR: An introduction Maciej Mensfeld Presented by: Maciej Mensfeld RoR: An introduction dev.mensfeld.pl github.com/mensfeld.
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. 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.
J2EE Web Fundamentals Lesson 1 Introduction and Overview
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
Chapter 3.2 – RoR: easier, faster, better Maciej Mensfeld Presented by: Maciej Mensfeld RoR: easier, faster, better mensfeld.pl github.com/mensfeld.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
A Scalable Application Architecture for composing News Portals on the Internet Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta Famagusta.
R4A Maciej Mensfeld O mnie: Maciej Mensfeld Ruby 4 Android dev.mensfeld.pl github.com/mensfeld.
WorkPlace Pro Utilities.
What is Sure BDCs? BDC stands for Batch Data Communication and is also known as Batch Input. It is a technique for mass input of data into SAP by simulating.
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.
Yii is “yes it is” from this we can know that surely it would be a highly needed technology for website developers for its high performance. It is suitable.
Lecture 11 Rails Topics SaaSSaaS Readings: SaaS book Ch February CSCE 740 Software Engineering.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
WEP Presentation for non-IT Steps and roles in software development 2. Skills developed in 1 st year 3. What can do a student in 1 st internship.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
Web Architecture update for WSAWG/WSDL TAG published Principles of the Web Contents: –Identifiers Most of the work –Formats Not much –Protocols Summary.
1 Web Servers (Chapter 21 – Pages( ) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System Architecture.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Web applications – what & why? Maciej Mensfeld Presented by: Maciej Mensfeld Web applications – what & why? dev.mensfeld.pl github.com/mensfeld.
GLite build and integration system Building and Packaging Robert HARAKALY
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
RESTful Web Services What is RESTful?
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Chapter 2 - OOP Maciej Mensfeld Presented by: Maciej Mensfeld More about OOP dev.mensfeld.pl github.com/mensfeld.
Intro to HAML By Me, Christopher Judge. What is a HAML? Known as the HTML Abstraction Markup Language. Which uses, “functions as a replacement for inline.
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.
1 LM 6 Database Applications Dr. Lei Li. Learning Objectives Explain three components of a client-server system Describe differences between a 2-tiered.
Live. learn. work. play Superior Avenue Suite 310 Cleveland Ohio Tel: Fax:
XML 1. Chapter 8 © 2013 Pearson Education, Inc. Publishing as Prentice Hall SAMPLE XML SCHEMA (XSD) 2 Schema is a record definition, analogous to the.
National College of Science & Information Technology.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
J2EE Platform Overview (Application Architecture)
Play Framework: Introduction
XML QUESTIONS AND ANSWERS
Microsoft Office Illustrated
WEB API.
$, $$, $$$ API testing Edition
JavaServer Faces: The Fundamentals
Chapter 3 – part2.
Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta
Middleware, Services, etc.
Chengyu Sun California State University, Los Angeles
Presentation transcript:

Chapter 4.1 – Deeper into Rails Maciej Mensfeld Presented by: Maciej Mensfeld Deeper into Rails mensfeld.pl github.com/mensfeld senior ruby

Maciej Mensfeld Please… …ask me to slow down, if I speak to quickly; …ask me again, if I forget; …ask questions, if anything i say is not clear; …feel free to share your own observations Deeper into Rails Chapter 4.1 – Deeper into Rails

Maciej Mensfeld I18n – we speak different languages! Chapter 4.1 – Deeper into Rails I18n - Easy-to-use and extensible framework for translating your application to a single custom language other than English or for providing multi-language support in your application. Every static string in the Rails framework — e.g. Active Record validation messages, time and date formats — has been internationalized You may be tempted to store the chosen locale in a session or a cookie. Do not do so. The locale should be transparent and a part of the URL. This way you don’t break people’s basic assumptions about the web itself: if you send a URL of some page to a

Maciej Mensfeld I18n – we speak different languages! Chapter 4.1 – Deeper into Rails Application controller:

Maciej Mensfeld I18n – we speak different languages! Chapter 4.1 – Deeper into Rails Try it out!

Maciej Mensfeld I18n – we speak different languages! Chapter 4.1 – Deeper into Rails Try it out!

Maciej Mensfeld I18n – we speak different languages! Chapter 4.1 – Deeper into Rails Workout time! ruby -Itest test/unit/i18n_test.rb

Maciej Mensfeld Be RESTful as much as you can be! Chapter 4.1 – Deeper into Rails Representational State Transfer Representational State Transfer (REST) is a style of software architecture for distributed systems such as the World Wide Web. Scalability of component interactions Generality of interfaces Independent deployment of components Intermediary components to reduce latency, enforce security and encapsulate legacy systems

Maciej Mensfeld Be RESTful as much as you can be! Chapter 4.1 – Deeper into Rails Don’t work with different models in one controller! Don’t use non standard actions (unless you really know what you are doing!) Think with resources, not with actions! Use restful routes (resources :users, etc)

Maciej Mensfeld Be RESTful as much as you can be! Chapter 4.1 – Deeper into Rails Use scopes and namespaces! Namespaces are good to separate different logic with same controller names (in different modules) Namespacing stuff helps you manage growing projects

Maciej Mensfeld plataformatec / Responders Chapter 4.1 – Deeper into Rails Sets the flash based on the controller action and resource status. Installation process:

Maciej Mensfeld plataformatec / Responders Chapter 4.1 – Deeper into Rails Responders uses the ‘valid?’ method to determine whether or not the object passed to ‘respond_with’ is valid You can also pass a :location parameter to redirect to a specified route

Maciej Mensfeld plataformatec / Responders Chapter 4.1 – Deeper into Rails Workout time! Install and use responders for our Post model in our example app (or in your app for a selected model)

Maciej Mensfeld Simplecov – Code coverage Chapter 4.1 – Deeper into Rails Code coverage is a measure used in software testing. It describes the degree to which the source code of a program has been tested. Primary gem for code coverage in Ruby project is Simplecov The main advantage of running a coverage tool on your test suite is to find areas of your code that are poorly tested.

Maciej Mensfeld Simplecov – Code coverage Chapter 4.1 – Deeper into Rails Edit: test_helper.rb ruby -Itest test/unit/user_test.rb View Rails.root/coverage.index.html

Maciej Mensfeld Haml + Simple form Chapter 4.1 – Deeper into Rails Haml (HTML abstraction markup language) is based on one primary principle: markup should be beautiful. It’s not just beauty for beauty’s sake either; Haml accelerates and simplifies template creation down to veritable haiku. gem ‘haml’ # Gemfile => bundle install

Maciej Mensfeld Haml + Simple form Chapter 4.1 – Deeper into Rails By default Haml uses DIVs Class declaration starts with dot (.class_name) Id declaration starts with hash (#super_id) To create „not DIV” use % (%h2) All Haml elements close automatically You can mix id, class and other attributes! Rich example: %h3.extra#content{:title => ‘Header title’}

Maciej Mensfeld Haml + Simple form Chapter 4.1 – Deeper into Rails Workout time! Change your App layout from erb to haml. Change your Post views from erb to haml HTML2HAML converter:

Maciej Mensfeld Haml + Simple form Chapter 4.1 – Deeper into Rails Rails forms made easy SimpleForm aims to be as flexible as possible while helping you with powerful components to create your forms. The basic goal of SimpleForm is to not touch your way of defining the layout, letting you find the better design for your eyes.

Maciej Mensfeld Haml + Simple form Chapter 4.1 – Deeper into Rails Simple form can be used with erb or haml templates (or with both)

Maciej Mensfeld Haml + Simple form Chapter 4.1 – Deeper into Rails Workout time! Change your forms from Rails std forms to simple form

Chapter 4.1 – Deeper into Rails Maciej Mensfeld Live long and prosper! Presented by: Maciej Mensfeld mensfeld.pl github.com/mensfeld