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

Creating and administrating events


Before we begin developing our application, we will take a cue from our previous project and build mockups for our events before we start. Again, we will use MockFlow for our purpose and build it.

Also, we will create a mockup for the event page, as shown in the following screenshot:

In this task, we will look at customizing our event views and also adding the custom before_filter object to protect our events.

Prepare for lift off

Taking a cue from the previous project, add a scaffold for events. The events schema looks as follows:

  create_table "events", force: true do |t|
    t.string   "title"
    t.datetime "start_date"
    t.datetime "end_date"
    t.string   "location"
    t.text     "agenda"
    t.text     "address"
    t.integer  "organizer_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

Add devise gem and generate authentication methods for the application.

We will have to associate the user and event; however, the trick here is we...