This is a cryptocurrency watchlist application built with Ruby on Rails.
- CoinRanking API.It is a free API that provides cryptocurrency data.
- Faker Gem. It is used to generate fake users.
User Table
| Column Name | Data Type |
|---|---|
| string | |
| password | string |
Cryptocurrency Table
| Column Name | Data Type |
|---|---|
| uuid | string |
| symbol | string |
| name | string |
| color | string |
| icon_url | string |
| market_cap | string |
| price | string |
| listed_at | integer |
| tier | integer |
| change | string |
| rank | integer |
| sparkline | text |
| low_volume | boolean |
| coinranking_url | string |
| volume_24h | string |
Watchlist Table
| Column Name | Data Type |
|---|---|
| user_id | references |
| name | string |
CryptocurrenciesWatchlists (Join Table)
| Column Name | Data Type |
|---|---|
| cryptocurrency_id | references |
| watchlist_id | references |
rails generate model Cryptocurrency uuid:string symbol:string name:string color:string icon_url:string market_cap:string price:string listed_at:integer tier:integer change:string rank:integer sparkline:text low_volume:boolean coinranking_url:string 24h_volume:string
rails generate model Watchlist user:references name:string
rails generate model CryptocurrenciesWatchlists cryptocurrency:references watchlist:referencesUse Devise to generate the User model.
rails generate devise:install
rails generate devise User
rails generate devise:viewsRun the migrations.
rails db:migrateclass User < ApplicationRecord
has_many :watchlists
has_many :cryptocurrencies, through: :watchlists
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
end
class Cryptocurrency < ApplicationRecord
has_many :cryptocurrencies_watchlists
has_many :watchlists, through: :cryptocurrencies_watchlists
validates :name, presence: true
end
class Watchlist < ApplicationRecord
belongs_to :user
has_many :cryptocurrencies_watchlists, dependent: :destroy
has_many :cryptocurrencies, through: :cryptocurrencies_watchlists
validates :user_id, presence: true
validates :name, presence: true
end
class CryptocurrenciesWatchlist < ApplicationRecord
belongs_to :cryptocurrency
belongs_to :watchlist
validates :cryptocurrency_id, presence: true
validates :watchlist_id, presence: true
end- Home Page - Information
- About Page - About the APIs and Author
- Coins Page - List all the cryptocurrencies
- Coin Details Page - Show the details of a cryptocurrency
- Sign Up Page - Create an account
- Log In Page - Log in to the application
- Watchlist Page - Show all the cryptocurrencies in the watchlist
- Single Watchlist Page - Show all the cryptocurrencies in the watchlist
Coins page -> Coin details page -> Add to watchlist -> Watchlist page -> Show all coins in the watchlist -> Show all watchlists
-
Use the kaminari gem to add pagination to the index page.
-
Easy to search and filter cryptocurrencies by name and rank.
-
Search a cryptocurrency by name, symbol in Top100 or All or Potential coins.
- Bootstrap 5
- Erb Conditional (if user is logged in, show the watchlist)
- HTML Validation
Use Git and GitHub to track changes and manage version control.
Haven't deployed yet. Plan to deploy to Heroku.
-
Ruby on Rails 實戰聖經 Good ebook to learn Ruby on Rails.
-
Learn Ruby on Rails - Full Course FreeCodeCamp Youtube video.
-
Sample: Board Game A sample project built with Ruby on Rails and deployed to Fly.io.
-
Many to many association between Cryptocurrency and Watchlist. If you want to add a cryptocurrency to a watchlist, you need to create a CryptocurrenciesWatchlist object. It you want to remove a cryptocurrency from a watchlist, you need to destroy the CryptocurrenciesWatchlist object.
-
Devise gem If you already have a User model, you need to run the migration to add the devise columns to the User table.
-
Search in the every page (navbar) I add the search form in the navbar, so I need to add the search function in every controller.
-
.... A lot of pitfalls to learn.







