Coder Social home page Coder Social logo

phase-2-assessment's Introduction

Events Management Application

By now you should be familiar with basic sinatra apps and creating simple websites. This problem will give you a chance to demonstrate your proficiency with the web by writing code for controllers, authentication, views, and basic HTML forms with a little bit of CSS. We're going full CRUD and building a simple event-management application.

The problem is broken into 4 parts. You will need to complete each part to move on. We've given approximate timing for each part. If you find you are taking a lot longer be sure to ask questions.

Objectives

Part 1: Authentication (Timing ~ 30 min)

Authentication is a central concern of most web applications. We're going to start by creating a simple app that does nothing more than authenticate a user.

User Model

You have an empty User model and a database with a users table. Add validations to the User model which guarantee the following:

  1. Every user has an email
  2. Every user's email is unique
  3. Every email looks like * @ *.*
  4. Every user has a password

You should not store the user's password directly in the database.

Sign Up, Log In, Log Out

Create views to allow a user to:

  1. Sign up as a new user
  2. Log in as an existing user
  3. Log out as an existing user

Part 2: Events (Timing ~ 30 min)

We have users and events. Users can attend many events and an event can be attended by many users. Events are user-created, too, so an event belongs to a user and a user can create multiple events.

Associations

We've already defined the three models for you. Create the correct associations between them.

The User model should have three associations on it. Given a user, make it so that

user.created_events

returns the list of events created by user and

user.attended_events

returns the list of events user is attending or has attended.

You'll need to use the :class_name argument to specify the associated class for the created_events and attended_events associations, like so:

class User < ActiveRecord::Base
  has_many :created_events,
           :class_name => 'Event'
end

ActiveRecord normally tries to guess the class name from the association name. In this case, because the association is called created_events, ActiveRecord would try guess that CreatedEvent is the class name. There's no such class and ActiveRecord would raise an exception.

Search for "class_name" in A Guide to Active Record Associations and "source" in Active Record Associations : has_manyto see other examples.

Part 3: CRUD It Up (Timing ~ 45 min)

With user authentication in place, create pages which let the user create new events, show their created events, edit events, and destroy events.

Part 4: AJAXify it (Timing ~ 30 min)

On the page that lists all the events created by the user, add the form for creating a new event. Use AJAX on this form so that when a user adds a new event, that new event is appended to the list of created events without refreshing the page.

phase-2-assessment's People

Contributors

jeffreywescott avatar keithtom avatar edshadi avatar aespaldi avatar amgando avatar zspencer avatar

Watchers

James Cloos avatar Kristine Jennings avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.