Phase 3 Ruby on Rails Bike Project

Mehmet Kusken
3 min readJul 25, 2021

Welcome to my ruby on rails bike project

I have 3 tables in my database . First one is Users . In my Users table there are username , email adress, password_digest and for google login option i needed uid ,provider .

For Bicycles table i have brand, wheel_size , color, price and urlpicture

The last one is the Payments .I have 3 Models . User has many Payments and has many Bicycles, through Payments . Bicycle has many Payments and has many Users through Payments. Payments belong to User and belongs to Payment . Thats why there are user_id , bicycle_id , card_information, exp_date(year) and security_code .

If you store user passwords in the clear, then an attacker who steals a copy of your database has a giant list of emails and passwords. Some of your users will only have one password for their email account, for their banking account, for their application. A simple hack could escalate into massive identity theft.It’s my responsibility as a web developer to make my web application secure blaming my users for not being security experts is not a professional response to risk.bcrypt gemallows to easily harden my application against these kinds of attacks. I need users credit card number too for payment . Users Credit card number will be filtered in my database too

I am using Ipa on my bicycle model in bicycle.rb file so I am taking information from my Ipa for Brand and Picture and save it to my database . You will see all this datas in my Bicycle Index page

I used Scope Method in my Bicycle model and you can search brand name on my Bicycle Index page and you will find the same brand name bicycles

In my Session controller file i used omniauth method and with this method you can login to my app with google . I used for my users table in database username , email adress and password . I take all these information from google Api except password . but i have to create user has to have password too for my database so they can login each time to use my app . thats why I equalled user password = SecureRandom.hex(15) . This code will give random secure password and save in my database .

I hope you enjoyed the app . Thank you so much

--

--

Mehmet Kusken

I am student at flatiron school for software engineering