evans22j / Budget-App

Budgy-Budget is a mobile web application where you can manage your budget. You have a list of transactions associated with a category so that you can see how much money you spent and on what. Built with Ruby on Rails, PostgreSQL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Budget-App

Description

The Ruby on Rails capstone project (remember what they are?) is about building a mobile web application where you can manage your budget: you have a list of transactions associated with a category, so that you can see how much money you spent and on what.

  • I created a Ruby on Rails application that allows the user to:

    • register and log in, so that the data is private to them.
    • introduce new transactions associated with a category.
    • see the money spent on each category.

Screenshots πŸ“Έ

Categories

Category-Details 

Learning objectives

  • Use ruby gems as software packages system.
  • Install Ruby on Rails framework.
  • Understand Rails RESTful design and router.
  • Use controllers to handle requests and render empty views.
  • Use params from browser request in a safe way.
  • Use preprocessed html file with embedded Ruby code.
  • Use layouts and templates for shared content.
  • Use database migration files to maintain database schema.
  • Use validations for models.
  • Secure app from n+1 problems.
  • Understand what ORM is.
  • Write SQL queries with ActiveRecord.
  • Set up associations between models.
  • uild a webapp that requires the user to log in.
  • Use devise gem for authentication.
  • Limit access to webapp resources based on authorization rules.
  • Analyze in writing why you have made a coding choice using one structure over another.

Live Demo πŸ”—

Live Demo Link

Loom Video πŸ”—

Loom Video Link

Getting Started

To get a local copy for this project and running follow these simple example steps.

Prerequisites

  • You need to have git installed in your machine.
  • Install a recent version of Postgres.
  • Already install Rails

Setup

Setting Up PostgreSQL

  • The postgres installation doesn't setup a user for you, so you'll need to follow these steps to create a user with permission to create databases
$  sudo -u postgres createuser blog-app -s

Creating the Budgy-Budget application

  • To create project with PostgreSQL database
$   rails new Rails-capstone-Budgy-Budget --database=postgresql  #or
$   rails new Rails-capstone-Budgy-Budget -d postgresql

$   cd Rails-capstone-Budget-app # Move into the application directory

Clone this repository

$ git clone https://github.com/evans22j/Budget-App.git
$ cd Budget-App

Create the database

$   rails db:create   # or
$   rake db:create

Install linter and

  • Rubocop gem
$  bundle init
$  bundle install
  • Stylelint package
$  npm init -y
$  npm install
$  npm install --save-dev stylelint@13.x stylelint-scss@3.x stylelint-config-standard@21.x stylelint-csstree-validator@1.x
  • Run linter
$  rubocop .
$  npx stylelint "**/*.{css,scss}" 
  • In auto-correct mode, RuboCop will try to automatically fix offenses:
$  rubocop -A # or
$  rubocop --auto-correct-all
$  npx stylelint "**/*.{css,scss}" --fix 

Starting up the Web Server

$   rails s # or
$   rails server # or
$   rails server -p3001
  • To restart the server
$  sudo service postgresql restart 
$  rails db:reset #to clean the database                                                                    

Listing Existing Routes

  • You can now visit http://localhost:3000 to view your new website!

You can also execute the rails routes command in your terminal to produce the same output.

Generate rspec

  • At the first you need to include those lines in your Gemfile
  gem 'rails-controller-testing'
  gem 'rspec-rails'

Install RSpec

$  rails generate rspec:install
  • This should generate some files that you will need to run your tests and should give us a Controller and a View

  • Then run:

$  rspec spec     # to test if your tests are passed

Generate MVC with scaffold

  $  rails g scaffold category name user:belongs_to
  $  rails g scaffold records name amount:decimal user:belongs_to 
  $  rails g scaffold category_records user:belongs_to
  $  rails g scaffold category_records category:belongs_to record:belongs_to

Generate Schema

  • To push the Migration into the database
  $   rails db:migrate
  • We use the seeds.rb file to records in the database
  • To drop, create a table and to migrate and send the seed into the database:
  $   rails db:drop db:create db:migrate db:seed  
  • To check available routes
  $   rails routes  

Run Capybara

$  bundle exec rspec ./spec/features/

Run spec

$  bundle exec rspec ./spec/models/

Built With πŸ› οΈ

This project is build with:

  • Ruby
  • Ruby on Rails

Authors

πŸ‘€ Evans Sitibekiso

🀝 Contributor

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a ⭐️ if you like this project!

Acknowledgments

πŸ“ License

This project is MIT licensed.

About

Budgy-Budget is a mobile web application where you can manage your budget. You have a list of transactions associated with a category so that you can see how much money you spent and on what. Built with Ruby on Rails, PostgreSQL.

License:MIT License


Languages

Language:Ruby 67.0%Language:HTML 24.7%Language:CSS 7.1%Language:JavaScript 1.1%