Book Image

Rails 4 Application Development HOTSHOT

By : Saurabh Bhatia
Book Image

Rails 4 Application Development HOTSHOT

By: Saurabh Bhatia

Overview of this book

<p>Rails is a rapidly moving, open source, web development framework, and keeping up to speed with it is a big task. You might have already built applications using it, but there have been significant changes in the syntax and semantic of the Rails framework in the latest upgrade.</p> <p>Rails 4 Application Development Hotshot shows you how to build the most popular types of applications using Rails 4, and highlights new ways to do things. The book also closely follows lots of the best practices, gems, and popular solutions already known to the community, and tracks the changes in these. This book brings new ideas to refactor and restructure code to make it perform better in production, and enables you to write production-ready code.</p>
Table of Contents (17 chapters)
Rails 4 Application Development HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

In the past few years, Rails has emerged as one of the most popular choices of framework for developing web applications. It is also one of the most popular courses on all the major websites that teach web development, and a lot of developers have built a career out of it. Rails is known for providing productivity to developers and allows them to write clean and functional human-readable code. The latest major version of Rails, Rails 4, is a feature-packed update with a lot of new syntaxes and patterns.

Rails 4 Application Development Hotshot presents a practical approach to upgrade your Rails knowledge to Rails 4. This is done by building the most popular types of applications that people usually build using Rails and highlighting the new ways of doing this as opposed to the old ones in the latest version. The book also closely follows best practices and the commonly used gems and their compatibility with the latest Rails version. While working on these projects, we will also see some new design patterns and get ideas to refactor our current codebase. This book will help you write basic applications that are customizable and scalable and introduce you to a wide spectrum of concepts and ideas.

What this book covers

Project 1, A Social Recipe-sharing Website, explains how to create a website where many users can sign up, log in, create food recipes, and categorize them into different types.

Project 2, Conference and Event RSVP Management, explains how to create an application where users can create events, organize meetups for different topics and themes, and other users can join them in these events.

Project 3, Creating an Online Social Pinboard, covers how to create an online pinboard, where a user can pin whatever he/she likes on to it and organize these objects. These pins can be repinned by other users on to their pinboards and thus create an online collection of the things or objects that people like.

Project 4, Creating a Restaurant Menu Builder, covers how to build a fully responsive system to create and manage menus for a restaurant. This project will port restaurant menus to tablets and smartphones and also demonstrate how to make an SaaS application in Rails.

Project 5, Building a Customizable Content Management System, explains how to create a customizable content management system to power simple content-driven websites. We will effectively create a system where designers will have the freedom to choose the frontend they want and end users can easily manage the content for that frontend.

Project 6, Creating an Analytics Dashboard using Rails and Mongoid, will cover tracking clicks, page views, and the location of the visitors who read the content generated from the website. We will analyze the data and generate different types of graphs that represent different types of data.

Project 7, Creating an API Mashup – Twitter and Google Maps, will dive into an API mashup of Twitter and Google Maps that will generate an application to map the locations of your friends who are tweeting. We will also filter these people based on country names.

Project 8, API Only Application – Backend for a Mobile App, explains an application where the entire backend is in the form of an API. The entire data will be available on the frontend in the form of JSON through API endpoints. The frontend can be a web or mobile application.

Project 9, Video Streaming Website using Rails and HTML5, explains how to create an application to upload and encode videos. This application will allow visitors to stream and watch videos using an HTML5-based player.

Project 10, A Rails Engines-based E-Commerce Platform, explains how to create a Rails engine for generating an e-commerce application. This is mountable inside a blank Rails application.

What you need for this book

In order to work with the projects in this book, you will need the following installed on your system:

  • Ruby 1.9.3

  • Rails 4

  • MySQL 5+

  • MongoDB

  • jQuery

  • ImageMagick

  • RMagick

  • Git

  • Morris.js

  • Apache Solr

  • Apache Tomcat

  • Bootstrap

  • Sass

  • Sublime Text

  • A tool for mock-ups

  • Haml

  • Memcached

  • Twitter API keys

  • Google Maps API keys

  • The Rails API

  • FFmpeg

  • Redis

  • Video.js

  • A GitHub account

  • Devise

  • Doorkeeper

All projects have been upgraded and tested with Ruby 2.0 and Rails 4.1.0 beta.

Who this book is for

This book is aimed at developers who are already familiar with the basics of the Rails framework and have worked with Rails 3.2 or earlier versions. As the book follows a practical approach and uses terminology specific to Rails and web programming, it is assumed you have some prior experience with the development of applications. This book will help you upgrade your knowledge and improve its applicability.

Conventions

In this book, you will find several headings that appear frequently. To give clear instructions of how to complete a procedure or task, we use:

Mission briefing

This section explains what you will build, with a screenshot of the completed project.

Why is it awesome?

This section explains why the project is cool, unique, exciting, and interesting. It describes what advantage the project will give you.

Your Hotshot objectives

This section explains the eight major tasks required to complete your project:

  • Task 1

  • Task 2

  • Task 3

  • Task 4

  • Task 5

  • Task 6

  • Task 7

  • Task 8

Mission checklist

This section explains any prerequisites for the project, such as resources or libraries that need to be downloaded, and so on.

Task 1

This section explains the task that you will perform.

Prepare for lift off

This section explains any preliminary work that you may need to do before beginning work on the task.

Engage thrusters

This section lists the steps required in order to complete the task.

Objective complete - mini debriefing

This section explains how the steps performed in the previous section allow us to complete the task. This section is mandatory.

Classified intel

This section provides extra information that is relevant to the task.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "In case the form validation fails, the file field is reset."

In all code blocks, the first line is the name of the file kept there for your reference, followed by the code. An example of a code block is shown as follows:

app/models/event.rb
class Event < ActiveRecord::Base
  belongs_to :organizers, class_name: "User"
end

Database migrations that appear in the book appear without the filename as the generated filename varies from system to system. Following is how it is defined in the book:

class AddPlanIdToUsers < ActiveRecord::Migration
  def change
    add_column :users, :plan_id, :integer
  end
end

Any command-line input or output is written as follows:

:~/pinpost$ rails g jquery:install

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "We are going to select From Scratch and build our wireframes using the given set of tools."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.