DEV Community

Roshaan Singh
Roshaan Singh

Posted on • Updated on

Rails App project

(https://github.com/RoUchiha/Flatiron-Phase-3-Rails-app-portfolio-project)

This project felt a lot like the project for Phase 2, only lengthier. Most of what was required of me was fairly simple, but the amount of coding that had to be done is what made this a challenge. More code means more chances for mistakes, and I ended up catching quite a few of my own.

The Rails app I made is a TV Show Tracker that allows users to sign up, create shows, and then leave ratings/reviews for other users to see once they have finished watching that show. The most challenging part of this app was getting the routes figured out and preventing access to pages if a user was not signed in. After that was done, the next challenge was creating the Rating and Comment objects via nested resources. Thanks to some Google searching, I eventually solved the errors that kept popping up and the rest of the app was easily completed. Utilizing OmniAuth to allow users to signup/login via GitHub was easy since I followed the conventions from a previous lesson.

def create 
        user = User.find_by(username: params[:session][:username].downcase)
        if user && user.authenticate(params[:session][:password])
            session[:user_id] = user.id 
            redirect_to user_path(user)
        else
            flash[:alert] = "Incorrect username and/or password. Please try again."
            render :new 
        end
    end
Enter fullscreen mode Exit fullscreen mode
def github_login
        @user = User.find_by(username: auth[:info][:nickname])

        if @user.nil?
            @user = User.new(
                username: auth[:info][:nickname],
                full_name: auth[:info][:name],
                password: SecureRandom.uuid
            )
        end
        if @user.save 
            session[:user_id] = @user.id 
            redirect_to user_path(session[:user_id])
        else
            render :new 
        end
    end
Enter fullscreen mode Exit fullscreen mode

This app utilizes a lot of has_many and has_many_through relationships that made the functionality of the app a lot smoother, and made it easy to create associations between parent and child objects. I also took advantage of Flash alerts to display errors and let users know why they cannot access a certain page.

An area I still need to improve on is making my app look nice via CSS/HTML styling. I kept everything a basic black and white barebones look so that I could finish the project as fast as possible and move on to the next Phase, but I plan on working towards getting better at styling for the next couple of projects.

This project felt like more of what would be expected of me in a "real world" situation where I need to make a website/app, and I feel like I have a strong grasp on these basics now.

Top comments (0)