Giter VIP home page Giter VIP logo

eventz's Introduction

Eventz - a sample Ruby on Rails app

This is a toy Ruby on Rails application created as part of the Level Up Tutorials beginner Ruby on Rails course https://leveluptutorials.com/tutorials/beginner-ruby-on-rails

You can find the app at https://eventzzzz.herokuapp.com/.

Contributing

Contributions are encouraged by folks taking the Level Up Tutorials course. Practice is often the best way to learn. If you are looking for contribution suggestions, please take a look at the issues tab.

Development

Fork this repository and clone it locally. Follow this guide if you need help.

You will need to setup postgresql and redis. You can use homebrew for installing on a mac:

brew install postgresql
brew install redis

brew services start postgresql
brew services start redis

Run the following commands to setup your environment:

  • bin/rails db:create for creating the database locally
  • bin/rails db:migrate for running all migrations

The following commands are used for development:

  • bin/dev will start your Rails server and all associated processes using the Procfile
  • bin/rails c will start your Rails console

Testing

The test suite is written using Minitest.

# Run the entire test suite
bin/rails test

# Run all model tests
bin/rails test test/models

# Run a specific test file
bin/rails test test/models/event_test.rb

# Run the example at a specific line number in the given test file
bin/rails test test/models/event_test.rb:4

Technology stack

  • Ruby 3.0.1.
  • Rails 7.0.

I have not added any additional gems. The goal is to keep it as vanilla Rails as possible.

See the Gemfile for all dependencies and their respective versions.

eventz's People

Contributors

luanzeba avatar

Stargazers

Mateo Wang avatar

Watchers

 avatar

eventz's Issues

Provide error message on duplicate RSVP

Problem statement

When a given user tries to RSVP to an event they’re already registered for we should display a flash message with the following content:

User has already registered for this event

CleanShot 2022-05-21 at 21 23 01@2x

Steps to reproduce

  1. Start your Rails server with bin/dev command
  2. Create an event at http://localhost:3000/events/new
  3. Create a user at http://localhost:3000/users/new
  4. Click RSVP on the event page twice

How to fix it

I have added unit tests to help guide you in the implementation in the duplicate_rsvp_message development branch.

I'd be happy to review your implementation when I have time. Please open a pull request following these steps:

  1. Follow this guide to setup your forked repo
  2. Checkout a development branch
git fetch upstream
git switch -c duplicate_rsvp_message upstream/duplicate_rsvp_message
  1. Run all tests to see what's failing with bin/rails test
  2. Make your changes to make tests pass
  3. Open a pull request and tag me for review

Implement user authentication

This is a large change. I'd recommend taking a look at good first issues first if you're not too comfortable with Rails yet.

Problem statement

The eventz app supports creation of users with some basic validations but it does not handle any user authentication or user sessions, which is a necessary step in order to RSVP to events as a specific user.

The goal of this issue is to create such user authentication and sessions.

Solution

Follow this thorough guide by Steve Polito for step-by-step instructions on how to set this up. Remember we already have a user model with an email field.

I'd be happy to review your implementation when I have time. Please open a pull request following these steps:

  1. Follow this guide to setup your forked repo
  2. Checkout a development branch
  3. Implement your changes
  4. Open a pull request and tag me for review

Implement location details

This is an intermediate to advanced change. I'd recommend taking a look at good first issues first if you're not too comfortable with Rails yet.

Problem statement

Our events do not specify a location at the moment. That's obviously a big problem for an event management app.

Solution

We should implement locations as a separate model. That will allow us to share the same location record among different events. For example, let's say the event RailsConf is happening at Oregon Convention Center. When we create that event, we will also create a location record for the Oregon Convention Center.
Then, a month later, Comic-Con schedules an event at the Oregon Convention Center. This time, we should use the existing location record.
This is powerful because it gives us the ability to find all events happening at a given location. We wouldn't have that power if we implemented location as just a string column in the events table.

Implementation details

  • Location should have its own model backed by a database table.
  • Location should belong_to events and an event should have_one location.
    • See video 14 - Creating a Registration Model (add link) for a refresher on setting up these relationships.
  • The location should have a name column, but I will leave it up to you on how you'd like to implement the address storage. I'd recommend doing some research and explaining the reasoning behind your recommendation.

I'd be happy to review your implementation when I have time. Please open a pull request following these steps:

  1. Follow this guide to setup your forked repo
  2. Checkout a development branch
  3. Implement your changes
  4. Open a pull request and tag me for review

Include number of attendees in event card

Problem statement

When visualizing events, a user has no idea how many people have already RSVP'd to it. We should add that information to the card using the following message:

X people attending

where X is the number of registrations to that event.

CleanShot 2022-05-22 at 09 50 59@2x

How to fix it

The code for the event card lives in app/views/events/_event.html.erb, so that's the first place you should look.
Look at the picture I shared above and think about how you would add the number of attendants.

I'd be happy to review your implementation when I have time. Please open a pull request following these steps:

  1. Follow this guide to setup your forked repo
  2. Checkout a development branch
  3. Implement your changes
  4. Open a pull request and tag me for review

Implement hotwire for users resource

Problem statement

We have implemented hotwire for event updates so that we can easily add, update or delete events in our app and the changes will be automatically reflected in all client sessions without needing a redirect or page refresh.

However, our user model does not have any hotwire implemented. The goal is to take what we learned from the events hotwire implementation and apply it to users.

Solution

Follow the steps in video 17 - Implementing Hotwire (add link) to implement hotwire for the users resource.

I'd be happy to review your implementation when I have time. Please open a pull request following these steps:

  1. Follow this guide to setup your forked repo
  2. Checkout a development branch
  3. Implement your changes
  4. Open a pull request and tag me for review

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.